summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
Diffstat (limited to 'example')
-rw-r--r--example/Alpha_complex/Alpha_complex_from_off.cpp63
-rw-r--r--example/Alpha_complex/Alpha_complex_from_points.cpp68
-rw-r--r--example/Alpha_complex/CMakeLists.txt35
-rw-r--r--example/Alpha_complex/alphaoffreader_for_doc_32.txt22
-rw-r--r--example/Alpha_complex/alphaoffreader_for_doc_60.txt27
-rw-r--r--example/Bitmap_cubical_complex/CMakeLists.txt10
-rw-r--r--example/Bitmap_cubical_complex/Random_bitmap_cubical_complex.cpp82
-rw-r--r--example/Bottleneck_distance/CMakeLists.txt21
-rw-r--r--example/Bottleneck_distance/README19
-rw-r--r--example/Bottleneck_distance/alpha_rips_persistence_bottleneck_distance.cpp190
-rw-r--r--example/Bottleneck_distance/bottleneck_basic_example.cpp50
-rw-r--r--example/Cech_complex/CMakeLists.txt16
-rw-r--r--example/Cech_complex/cech_complex_example_from_points.cpp54
-rw-r--r--example/Cech_complex/cech_complex_example_from_points_for_doc.txt31
-rw-r--r--example/Cech_complex/cech_complex_step_by_step.cpp166
-rw-r--r--example/Contraction/CMakeLists.txt17
-rw-r--r--example/Contraction/Garland_heckbert.cpp192
-rw-r--r--example/Contraction/Garland_heckbert/Error_quadric.h182
-rw-r--r--example/Contraction/Rips_contraction.cpp98
-rw-r--r--example/Nerve_GIC/CMakeLists.txt28
-rw-r--r--example/Nerve_GIC/CoordGIC.cpp96
-rw-r--r--example/Nerve_GIC/FuncGIC.cpp94
-rw-r--r--example/Persistence_representations/CMakeLists.txt28
-rw-r--r--example/Persistence_representations/persistence_heat_maps.cpp80
-rw-r--r--example/Persistence_representations/persistence_intervals.cpp89
-rw-r--r--example/Persistence_representations/persistence_landscape.cpp86
-rw-r--r--example/Persistence_representations/persistence_landscape_on_grid.cpp82
-rw-r--r--example/Persistence_representations/persistence_vectors.cpp74
-rw-r--r--example/Persistent_cohomology/CMakeLists.txt69
-rw-r--r--example/Persistent_cohomology/README67
-rw-r--r--example/Persistent_cohomology/custom_persistence_sort.cpp137
-rw-r--r--example/Persistent_cohomology/persistence_from_file.cpp143
-rw-r--r--example/Persistent_cohomology/persistence_from_simple_simplex_tree.cpp175
-rw-r--r--example/Persistent_cohomology/plain_homology.cpp94
-rw-r--r--example/Persistent_cohomology/rips_multifield_persistence.cpp154
-rw-r--r--example/Persistent_cohomology/rips_persistence_step_by_step.cpp166
-rw-r--r--example/Persistent_cohomology/rips_persistence_via_boundary_matrix.cpp172
-rw-r--r--example/Rips_complex/CMakeLists.txt71
-rw-r--r--example/Rips_complex/example_one_skeleton_rips_from_correlation_matrix.cpp81
-rw-r--r--example/Rips_complex/example_one_skeleton_rips_from_distance_matrix.cpp58
-rw-r--r--example/Rips_complex/example_one_skeleton_rips_from_points.cpp52
-rw-r--r--example/Rips_complex/example_rips_complex_from_csv_distance_matrix_file.cpp72
-rw-r--r--example/Rips_complex/example_rips_complex_from_off_file.cpp71
-rw-r--r--example/Rips_complex/example_sparse_rips.cpp30
-rw-r--r--example/Rips_complex/full_skeleton_rips_for_doc.txt26
-rw-r--r--example/Rips_complex/one_skeleton_rips_for_doc.txt20
-rw-r--r--example/Rips_complex/one_skeleton_rips_from_correlation_matrix_for_doc.txt17
-rw-r--r--example/Simplex_tree/CMakeLists.txt54
-rw-r--r--example/Simplex_tree/README73
-rw-r--r--example/Simplex_tree/cech_complex_cgal_mini_sphere_3d.cpp221
-rw-r--r--example/Simplex_tree/example_alpha_shapes_3_simplex_tree_from_off_file.cpp276
-rw-r--r--example/Simplex_tree/graph_expansion_with_blocker.cpp77
-rw-r--r--example/Simplex_tree/mini_simplex_tree.cpp66
-rw-r--r--example/Simplex_tree/simple_simplex_tree.cpp268
-rw-r--r--example/Simplex_tree/simplex_tree_from_cliques_of_graph.cpp121
-rw-r--r--example/Skeleton_blocker/CMakeLists.txt13
-rw-r--r--example/Skeleton_blocker/Skeleton_blocker_from_simplices.cpp77
-rw-r--r--example/Skeleton_blocker/Skeleton_blocker_iteration.cpp85
-rw-r--r--example/Skeleton_blocker/Skeleton_blocker_link.cpp69
-rw-r--r--example/Spatial_searching/CMakeLists.txt9
-rw-r--r--example/Spatial_searching/example_spatial_searching.cpp60
-rw-r--r--example/Subsampling/CMakeLists.txt22
-rw-r--r--example/Subsampling/example_choose_n_farthest_points.cpp29
-rw-r--r--example/Subsampling/example_custom_kernel.cpp65
-rw-r--r--example/Subsampling/example_pick_n_random_points.cpp27
-rw-r--r--example/Subsampling/example_sparsify_point_set.cpp27
-rw-r--r--example/Tangential_complex/CMakeLists.txt20
-rw-r--r--example/Tangential_complex/example_basic.cpp46
-rw-r--r--example/Tangential_complex/example_with_perturb.cpp53
-rw-r--r--example/Witness_complex/CMakeLists.txt34
-rw-r--r--example/Witness_complex/example_nearest_landmark_table.cpp47
-rw-r--r--example/Witness_complex/example_strong_witness_complex_off.cpp57
-rw-r--r--example/Witness_complex/example_witness_complex_off.cpp62
-rw-r--r--example/Witness_complex/example_witness_complex_sphere.cpp70
-rw-r--r--example/Witness_complex/generators.h166
-rw-r--r--example/common/CMakeLists.txt36
-rw-r--r--example/common/cgal3Doffreader_result.txt8
-rw-r--r--example/common/example_CGAL_3D_points_off_reader.cpp41
-rw-r--r--example/common/example_CGAL_points_off_reader.cpp46
-rw-r--r--example/common/example_vector_double_points_off_reader.cpp43
-rw-r--r--example/common/vectordoubleoffreader_result.txt7
81 files changed, 0 insertions, 6050 deletions
diff --git a/example/Alpha_complex/Alpha_complex_from_off.cpp b/example/Alpha_complex/Alpha_complex_from_off.cpp
deleted file mode 100644
index d411e90a..00000000
--- a/example/Alpha_complex/Alpha_complex_from_off.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-#include <gudhi/Alpha_complex.h>
-// to construct a simplex_tree from alpha complex
-#include <gudhi/Simplex_tree.h>
-
-#include <CGAL/Epick_d.h>
-
-#include <iostream>
-#include <string>
-
-void usage(int nbArgs, char * const progName) {
- std::cerr << "Error: Number of arguments (" << nbArgs << ") is not correct\n";
- std::cerr << "Usage: " << progName << " filename.off alpha_square_max_value [ouput_file.txt]\n";
- std::cerr << " i.e.: " << progName << " ../../data/points/alphacomplexdoc.off 60.0\n";
- exit(-1); // ----- >>
-}
-
-int main(int argc, char **argv) {
- if ((argc != 3) && (argc != 4)) usage(argc, (argv[0] - 1));
-
- std::string off_file_name {argv[1]};
- double alpha_square_max_value {atof(argv[2])};
-
- // ----------------------------------------------------------------------------
- // Init of an alpha complex from an OFF file
- // ----------------------------------------------------------------------------
- using Kernel = CGAL::Epick_d< CGAL::Dynamic_dimension_tag >;
- Gudhi::alpha_complex::Alpha_complex<Kernel> alpha_complex_from_file(off_file_name);
-
- std::streambuf* streambufffer;
- std::ofstream ouput_file_stream;
-
- if (argc == 4) {
- ouput_file_stream.open(std::string(argv[3]));
- streambufffer = ouput_file_stream.rdbuf();
- } else {
- streambufffer = std::cout.rdbuf();
- }
-
- Gudhi::Simplex_tree<> simplex;
- if (alpha_complex_from_file.create_complex(simplex, alpha_square_max_value)) {
- std::ostream output_stream(streambufffer);
-
- // ----------------------------------------------------------------------------
- // Display information about the alpha complex
- // ----------------------------------------------------------------------------
- output_stream << "Alpha complex is of dimension " << simplex.dimension() <<
- " - " << simplex.num_simplices() << " simplices - " <<
- simplex.num_vertices() << " vertices." << std::endl;
-
- output_stream << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" <<
- std::endl;
- for (auto f_simplex : simplex.filtration_simplex_range()) {
- output_stream << " ( ";
- for (auto vertex : simplex.simplex_vertex_range(f_simplex)) {
- output_stream << vertex << " ";
- }
- output_stream << ") -> " << "[" << simplex.filtration(f_simplex) << "] ";
- output_stream << std::endl;
- }
- }
- ouput_file_stream.close();
- return 0;
-}
diff --git a/example/Alpha_complex/Alpha_complex_from_points.cpp b/example/Alpha_complex/Alpha_complex_from_points.cpp
deleted file mode 100644
index c19f7cc8..00000000
--- a/example/Alpha_complex/Alpha_complex_from_points.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-#include <gudhi/Alpha_complex.h>
-// to construct a simplex_tree from alpha complex
-#include <gudhi/Simplex_tree.h>
-
-#include <CGAL/Epick_d.h>
-
-#include <iostream>
-#include <string>
-#include <vector>
-#include <limits> // for numeric limits
-
-using Kernel = CGAL::Epick_d< CGAL::Dimension_tag<2> >;
-using Point = Kernel::Point_d;
-using Vector_of_points = std::vector<Point>;
-
-void usage(int nbArgs, char * const progName) {
- std::cerr << "Error: Number of arguments (" << nbArgs << ") is not correct\n";
- std::cerr << "Usage: " << progName << " [alpha_square_max_value]\n";
- std::cerr << " i.e.: " << progName << " 60.0\n";
- exit(-1); // ----- >>
-}
-
-int main(int argc, char **argv) {
- if ((argc != 1) && (argc != 2)) usage(argc, (argv[0] - 1));
-
- // Delaunay complex if alpha_square_max_value is not given by the user.
- double alpha_square_max_value {std::numeric_limits<double>::infinity()};
- if (argc == 2)
- alpha_square_max_value = atof(argv[1]);
-
- // ----------------------------------------------------------------------------
- // Init of a list of points
- // ----------------------------------------------------------------------------
- Vector_of_points points;
- points.push_back(Point(1.0, 1.0));
- points.push_back(Point(7.0, 0.0));
- points.push_back(Point(4.0, 6.0));
- points.push_back(Point(9.0, 6.0));
- points.push_back(Point(0.0, 14.0));
- points.push_back(Point(2.0, 19.0));
- points.push_back(Point(9.0, 17.0));
-
- // ----------------------------------------------------------------------------
- // Init of an alpha complex from the list of points
- // ----------------------------------------------------------------------------
- Gudhi::alpha_complex::Alpha_complex<Kernel> alpha_complex_from_points(points);
-
- Gudhi::Simplex_tree<> simplex;
- if (alpha_complex_from_points.create_complex(simplex, alpha_square_max_value)) {
- // ----------------------------------------------------------------------------
- // Display information about the alpha complex
- // ----------------------------------------------------------------------------
- std::cout << "Alpha complex is of dimension " << simplex.dimension() <<
- " - " << simplex.num_simplices() << " simplices - " <<
- simplex.num_vertices() << " vertices." << std::endl;
-
- std::cout << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" << std::endl;
- for (auto f_simplex : simplex.filtration_simplex_range()) {
- std::cout << " ( ";
- for (auto vertex : simplex.simplex_vertex_range(f_simplex)) {
- std::cout << vertex << " ";
- }
- std::cout << ") -> " << "[" << simplex.filtration(f_simplex) << "] ";
- std::cout << std::endl;
- }
- }
- return 0;
-}
diff --git a/example/Alpha_complex/CMakeLists.txt b/example/Alpha_complex/CMakeLists.txt
deleted file mode 100644
index 2fc62452..00000000
--- a/example/Alpha_complex/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-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 ( Alpha_complex_example_from_points Alpha_complex_from_points.cpp )
- target_link_libraries(Alpha_complex_example_from_points ${CGAL_LIBRARY})
- add_executable ( Alpha_complex_example_from_off Alpha_complex_from_off.cpp )
- target_link_libraries(Alpha_complex_example_from_off ${CGAL_LIBRARY})
- if (TBB_FOUND)
- target_link_libraries(Alpha_complex_example_from_points ${TBB_LIBRARIES})
- target_link_libraries(Alpha_complex_example_from_off ${TBB_LIBRARIES})
- endif()
-
- 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(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()
-
- install(TARGETS Alpha_complex_example_from_points DESTINATION bin)
- install(TARGETS Alpha_complex_example_from_off DESTINATION bin)
-
-endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
diff --git a/example/Alpha_complex/alphaoffreader_for_doc_32.txt b/example/Alpha_complex/alphaoffreader_for_doc_32.txt
deleted file mode 100644
index 13183e86..00000000
--- a/example/Alpha_complex/alphaoffreader_for_doc_32.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-Alpha complex is of dimension 2 - 20 simplices - 7 vertices.
-Iterator on alpha complex simplices in the filtration order, with [filtration value]:
- ( 0 ) -> [0]
- ( 1 ) -> [0]
- ( 2 ) -> [0]
- ( 3 ) -> [0]
- ( 4 ) -> [0]
- ( 5 ) -> [0]
- ( 6 ) -> [0]
- ( 3 2 ) -> [6.25]
- ( 5 4 ) -> [7.25]
- ( 2 0 ) -> [8.5]
- ( 1 0 ) -> [9.25]
- ( 3 1 ) -> [10]
- ( 2 1 ) -> [11.25]
- ( 3 2 1 ) -> [12.5]
- ( 2 1 0 ) -> [12.9959]
- ( 6 5 ) -> [13.25]
- ( 4 2 ) -> [20]
- ( 6 4 ) -> [22.7367]
- ( 6 5 4 ) -> [22.7367]
- ( 6 3 ) -> [30.25]
diff --git a/example/Alpha_complex/alphaoffreader_for_doc_60.txt b/example/Alpha_complex/alphaoffreader_for_doc_60.txt
deleted file mode 100644
index 71f29a00..00000000
--- a/example/Alpha_complex/alphaoffreader_for_doc_60.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-Alpha complex is of dimension 2 - 25 simplices - 7 vertices.
-Iterator on alpha complex simplices in the filtration order, with [filtration value]:
- ( 0 ) -> [0]
- ( 1 ) -> [0]
- ( 2 ) -> [0]
- ( 3 ) -> [0]
- ( 4 ) -> [0]
- ( 5 ) -> [0]
- ( 6 ) -> [0]
- ( 3 2 ) -> [6.25]
- ( 5 4 ) -> [7.25]
- ( 2 0 ) -> [8.5]
- ( 1 0 ) -> [9.25]
- ( 3 1 ) -> [10]
- ( 2 1 ) -> [11.25]
- ( 3 2 1 ) -> [12.5]
- ( 2 1 0 ) -> [12.9959]
- ( 6 5 ) -> [13.25]
- ( 4 2 ) -> [20]
- ( 6 4 ) -> [22.7367]
- ( 6 5 4 ) -> [22.7367]
- ( 6 3 ) -> [30.25]
- ( 6 2 ) -> [36.5]
- ( 6 3 2 ) -> [36.5]
- ( 6 4 2 ) -> [37.2449]
- ( 4 0 ) -> [59.7107]
- ( 4 2 0 ) -> [59.7107]
diff --git a/example/Bitmap_cubical_complex/CMakeLists.txt b/example/Bitmap_cubical_complex/CMakeLists.txt
deleted file mode 100644
index dc659f2d..00000000
--- a/example/Bitmap_cubical_complex/CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-project(Bitmap_cubical_complex_examples)
-
-add_executable ( Random_bitmap_cubical_complex Random_bitmap_cubical_complex.cpp )
-if (TBB_FOUND)
- target_link_libraries(Random_bitmap_cubical_complex ${TBB_LIBRARIES})
-endif()
-add_test(NAME Bitmap_cubical_complex_example_random COMMAND $<TARGET_FILE:Random_bitmap_cubical_complex>
- "2" "100" "100")
-
-install(TARGETS Random_bitmap_cubical_complex DESTINATION bin)
diff --git a/example/Bitmap_cubical_complex/Random_bitmap_cubical_complex.cpp b/example/Bitmap_cubical_complex/Random_bitmap_cubical_complex.cpp
deleted file mode 100644
index 6eb24040..00000000
--- a/example/Bitmap_cubical_complex/Random_bitmap_cubical_complex.cpp
+++ /dev/null
@@ -1,82 +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.
- *
- * Author(s): 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/>.
- */
-
-// for persistence algorithm
-#include <gudhi/reader_utils.h>
-#include <gudhi/Bitmap_cubical_complex.h>
-#include <gudhi/Persistent_cohomology.h>
-
-// standard stuff
-#include <iostream>
-#include <sstream>
-#include <vector>
-
-int main(int argc, char** argv) {
- srand(time(0));
-
- std::cout
- << "This program computes persistent homology, by using bitmap_cubical_complex class, of cubical "
- << "complexes. The first parameter of the program is the dimension D of the bitmap. The next D parameters are "
- << "number of top dimensional cubes in each dimension of the bitmap. The program will create random cubical "
- << "complex of that sizes and compute persistent homology of it." << std::endl;
-
- int p = 2;
- double min_persistence = 0;
-
- if (argc < 3) {
- std::cerr << "Wrong number of parameters, the program will now terminate\n";
- return 1;
- }
-
- size_t dimensionOfBitmap = (size_t)atoi(argv[1]);
- std::vector<unsigned> sizes;
- size_t multipliers = 1;
- for (size_t dim = 0; dim != dimensionOfBitmap; ++dim) {
- unsigned sizeInThisDimension = (unsigned)atoi(argv[2 + dim]);
- sizes.push_back(sizeInThisDimension);
- multipliers *= sizeInThisDimension;
- }
-
- std::vector<double> data;
- for (size_t i = 0; i != multipliers; ++i) {
- data.push_back(rand() / static_cast<double>(RAND_MAX));
- }
-
- typedef Gudhi::cubical_complex::Bitmap_cubical_complex_base<double> Bitmap_cubical_complex_base;
- typedef Gudhi::cubical_complex::Bitmap_cubical_complex<Bitmap_cubical_complex_base> Bitmap_cubical_complex;
- Bitmap_cubical_complex b(sizes, data);
-
- // Compute the persistence diagram of the complex
- typedef Gudhi::persistent_cohomology::Field_Zp Field_Zp;
- typedef Gudhi::persistent_cohomology::Persistent_cohomology<Bitmap_cubical_complex, Field_Zp> Persistent_cohomology;
- Persistent_cohomology pcoh(b);
- pcoh.init_coefficients(p); // initializes the coefficient field for homology
- pcoh.compute_persistent_cohomology(min_persistence);
-
- std::stringstream ss;
- ss << "randomComplex_persistence";
- std::ofstream out(ss.str().c_str());
- pcoh.output_diagram(out);
- out.close();
-
- return 0;
-}
diff --git a/example/Bottleneck_distance/CMakeLists.txt b/example/Bottleneck_distance/CMakeLists.txt
deleted file mode 100644
index c6f10127..00000000
--- a/example/Bottleneck_distance/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-project(Bottleneck_distance_examples)
-
-if (NOT CGAL_VERSION VERSION_LESS 4.8.1)
- 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(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_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")
-
- install(TARGETS bottleneck_basic_example DESTINATION bin)
- install(TARGETS alpha_rips_persistence_bottleneck_distance DESTINATION bin)
-
-endif (NOT CGAL_VERSION VERSION_LESS 4.8.1)
diff --git a/example/Bottleneck_distance/README b/example/Bottleneck_distance/README
deleted file mode 100644
index 01bcd74a..00000000
--- a/example/Bottleneck_distance/README
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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/alpha_rips_persistence_bottleneck_distance.cpp b/example/Bottleneck_distance/alpha_rips_persistence_bottleneck_distance.cpp
deleted file mode 100644
index 2db1ef80..00000000
--- a/example/Bottleneck_distance/alpha_rips_persistence_bottleneck_distance.cpp
+++ /dev/null
@@ -1,190 +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.
- *
- * Author(s): Vincent Rouvreau
- *
- * 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/>.
- */
-
-#include <gudhi/Alpha_complex.h>
-#include <gudhi/Rips_complex.h>
-#include <gudhi/distance_functions.h>
-#include <gudhi/Simplex_tree.h>
-#include <gudhi/Persistent_cohomology.h>
-#include <gudhi/Points_off_io.h>
-#include <gudhi/Bottleneck.h>
-
-#include <CGAL/Epick_d.h>
-
-#include <boost/program_options.hpp>
-
-#include <string>
-#include <vector>
-#include <limits> // infinity
-#include <utility> // for pair
-#include <algorithm> // for transform
-
-
-// Types definition
-using Simplex_tree = Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_fast_persistence>;
-using Filtration_value = Simplex_tree::Filtration_value;
-using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
-using Field_Zp = Gudhi::persistent_cohomology::Field_Zp;
-using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomology<Simplex_tree, Field_Zp >;
-using Kernel = CGAL::Epick_d< CGAL::Dynamic_dimension_tag >;
-using Point_d = Kernel::Point_d;
-using Points_off_reader = Gudhi::Points_off_reader<Point_d>;
-
-void program_options(int argc, char * argv[]
- , std::string & off_file_points
- , Filtration_value & threshold
- , int & dim_max
- , int & p
- , Filtration_value & min_persistence);
-
-static inline std::pair<double, double> compute_root_square(std::pair<double, double> input) {
- return std::make_pair(std::sqrt(input.first), std::sqrt(input.second));
-}
-
-int main(int argc, char * argv[]) {
- std::string off_file_points;
- Filtration_value threshold;
- int dim_max;
- int p;
- Filtration_value min_persistence;
-
- program_options(argc, argv, off_file_points, threshold, dim_max, p, min_persistence);
-
- Points_off_reader off_reader(off_file_points);
-
- // --------------------------------------------
- // Rips persistence
- // --------------------------------------------
- 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;
-
- rips_complex.create_complex(rips_stree, dim_max);
- std::cout << "The Rips complex contains " << rips_stree.num_simplices() << " simplices and has dimension "
- << rips_stree.dimension() << " \n";
-
- // Sort the simplices in the order of the filtration
- rips_stree.initialize_filtration();
-
- // Compute the persistence diagram of the complex
- Persistent_cohomology rips_pcoh(rips_stree);
- // initializes the coefficient field for homology
- rips_pcoh.init_coefficients(p);
- rips_pcoh.compute_persistent_cohomology(min_persistence);
-
- // rips_pcoh.output_diagram();
-
- // --------------------------------------------
- // Alpha persistence
- // --------------------------------------------
- Gudhi::alpha_complex::Alpha_complex<Kernel> alpha_complex(off_reader.get_point_cloud());
-
- Simplex_tree alpha_stree;
- alpha_complex.create_complex(alpha_stree, threshold * threshold);
- std::cout << "The Alpha complex contains " << alpha_stree.num_simplices() << " simplices and has dimension "
- << alpha_stree.dimension() << " \n";
-
- // Sort the simplices in the order of the filtration
- alpha_stree.initialize_filtration();
-
- // Compute the persistence diagram of the complex
- Persistent_cohomology alpha_pcoh(alpha_stree);
- // initializes the coefficient field for homology
- alpha_pcoh.init_coefficients(p);
- alpha_pcoh.compute_persistent_cohomology(min_persistence * min_persistence);
-
- // alpha_pcoh.output_diagram();
-
- // --------------------------------------------
- // Bottleneck distance between both persistence
- // --------------------------------------------
- double max_b_distance {};
- for (int dim = 0; dim < dim_max; dim ++) {
- std::vector< std::pair< Filtration_value , Filtration_value > > rips_intervals;
- std::vector< std::pair< Filtration_value , Filtration_value > > alpha_intervals;
- rips_intervals = rips_pcoh.intervals_in_dimension(dim);
- alpha_intervals = alpha_pcoh.intervals_in_dimension(dim);
- std::transform(alpha_intervals.begin(), alpha_intervals.end(), alpha_intervals.begin(), compute_root_square);
-
- double bottleneck_distance = Gudhi::persistence_diagram::bottleneck_distance(rips_intervals, alpha_intervals);
- std::cout << "In dimension " << dim << ", bottleneck distance = " << bottleneck_distance << std::endl;
- if (bottleneck_distance > max_b_distance)
- max_b_distance = bottleneck_distance;
- }
- std::cout << "================================================================================" << std::endl;
- std::cout << "Bottleneck distance is " << max_b_distance << std::endl;
-
- return 0;
-}
-
-void program_options(int argc, char * argv[]
- , std::string & off_file_points
- , Filtration_value & threshold
- , int & dim_max
- , int & p
- , Filtration_value & min_persistence) {
- namespace po = boost::program_options;
- po::options_description hidden("Hidden options");
- hidden.add_options()
- ("input-file", po::value<std::string>(&off_file_points),
- "Name of an OFF file containing a point set.\n");
-
- po::options_description visible("Allowed options", 100);
- visible.add_options()
- ("help,h", "produce help message")
- ("max-edge-length,r",
- po::value<Filtration_value>(&threshold)->default_value(std::numeric_limits<Filtration_value>::infinity()),
- "Maximal length of an edge for the Rips complex construction.")
- ("cpx-dimension,d", po::value<int>(&dim_max)->default_value(1),
- "Maximal dimension of the Rips complex we want to compute.")
- ("field-charac,p", po::value<int>(&p)->default_value(11),
- "Characteristic p of the coefficient field Z/pZ for computing homology.")
- ("min-persistence,m", po::value<Filtration_value>(&min_persistence),
- "Minimal lifetime of homology feature to be recorded. Default is 0. Enter a negative value to see zero length intervals");
-
- po::positional_options_description pos;
- pos.add("input-file", 1);
-
- po::options_description all;
- all.add(visible).add(hidden);
-
- po::variables_map vm;
- po::store(po::command_line_parser(argc, argv).
- options(all).positional(pos).run(), vm);
- po::notify(vm);
-
- if (vm.count("help") || !vm.count("input-file")) {
- std::cout << std::endl;
- std::cout << "Compute the persistent homology with coefficient field Z/pZ \n";
- std::cout << "of a Rips complex defined on a set of input points.\n \n";
- std::cout << "The output diagram contains one bar per line, written with the convention: \n";
- std::cout << " p dim b d \n";
- std::cout << "where dim is the dimension of the homological feature,\n";
- std::cout << "b and d are respectively the birth and death of the feature and \n";
- std::cout << "p is the characteristic of the field Z/pZ used for homology coefficients." << std::endl << std::endl;
-
- std::cout << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl;
- std::cout << visible << std::endl;
- exit(-1);
- }
-}
diff --git a/example/Bottleneck_distance/bottleneck_basic_example.cpp b/example/Bottleneck_distance/bottleneck_basic_example.cpp
deleted file mode 100644
index 3df7d12d..00000000
--- a/example/Bottleneck_distance/bottleneck_basic_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 <iostream>
-#include <vector>
-#include <utility> // for pair
-#include <limits> // for numeric_limits
-
-int main() {
- std::vector< std::pair<double, double> > v1, v2;
-
- v1.emplace_back(2.7, 3.7);
- v1.emplace_back(9.6, 14.);
- v1.emplace_back(34.2, 34.974);
- v1.emplace_back(3., std::numeric_limits<double>::infinity());
-
- v2.emplace_back(2.8, 4.45);
- v2.emplace_back(9.5, 14.1);
- v2.emplace_back(3.2, std::numeric_limits<double>::infinity());
-
-
- double b = Gudhi::persistence_diagram::bottleneck_distance(v1, v2);
-
- std::cout << "Bottleneck distance = " << b << std::endl;
-
- b = Gudhi::persistence_diagram::bottleneck_distance(v1, v2, 0.1);
-
- std::cout << "Approx bottleneck distance = " << b << std::endl;
-}
diff --git a/example/Cech_complex/CMakeLists.txt b/example/Cech_complex/CMakeLists.txt
deleted file mode 100644
index ab391215..00000000
--- a/example/Cech_complex/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-cmake_minimum_required(VERSION 2.6)
-project(Cech_complex_examples)
-
-add_executable ( Cech_complex_example_step_by_step cech_complex_step_by_step.cpp )
-target_link_libraries(Cech_complex_example_step_by_step ${Boost_PROGRAM_OPTIONS_LIBRARY})
-if (TBB_FOUND)
- target_link_libraries(Cech_complex_example_step_by_step ${TBB_LIBRARIES})
-endif()
-add_test(NAME Cech_complex_utility_from_rips_on_tore_3D COMMAND $<TARGET_FILE:Cech_complex_example_step_by_step>
- "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "-r" "0.25" "-d" "3")
-
-add_executable ( Cech_complex_example_from_points cech_complex_example_from_points.cpp)
-if (TBB_FOUND)
- target_link_libraries(Cech_complex_example_from_points ${TBB_LIBRARIES})
-endif()
-add_test(NAME Cech_complex_example_from_points COMMAND $<TARGET_FILE:Cech_complex_example_from_points>)
diff --git a/example/Cech_complex/cech_complex_example_from_points.cpp b/example/Cech_complex/cech_complex_example_from_points.cpp
deleted file mode 100644
index 3cc5a4df..00000000
--- a/example/Cech_complex/cech_complex_example_from_points.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <gudhi/Cech_complex.h>
-#include <gudhi/Simplex_tree.h>
-
-#include <iostream>
-#include <string>
-#include <vector>
-#include <array>
-
-int main() {
- // Type definitions
- using Point_cloud = std::vector<std::array<double, 2>>;
- using Simplex_tree = Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_fast_persistence>;
- using Filtration_value = Simplex_tree::Filtration_value;
- using Cech_complex = Gudhi::cech_complex::Cech_complex<Simplex_tree, Point_cloud>;
-
- Point_cloud points;
- points.push_back({1., 0.}); // 0
- points.push_back({0., 1.}); // 1
- points.push_back({2., 1.}); // 2
- points.push_back({3., 2.}); // 3
- points.push_back({0., 3.}); // 4
- points.push_back({3. + std::sqrt(3.), 3.}); // 5
- points.push_back({1., 4.}); // 6
- points.push_back({3., 4.}); // 7
- points.push_back({2., 4. + std::sqrt(3.)}); // 8
- points.push_back({0., 4.}); // 9
- points.push_back({-0.5, 2.}); // 10
-
- // ----------------------------------------------------------------------------
- // Init of a Cech complex from points
- // ----------------------------------------------------------------------------
- Filtration_value max_radius = 1.;
- Cech_complex cech_complex_from_points(points, max_radius);
-
- Simplex_tree stree;
- cech_complex_from_points.create_complex(stree, 2);
- // ----------------------------------------------------------------------------
- // Display information about the one skeleton Cech complex
- // ----------------------------------------------------------------------------
- std::cout << "Cech complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() << " simplices - "
- << stree.num_vertices() << " vertices." << std::endl;
-
- std::cout << "Iterator on Cech complex simplices in the filtration order, with [filtration value]:" << std::endl;
- for (auto f_simplex : stree.filtration_simplex_range()) {
- std::cout << " ( ";
- for (auto vertex : stree.simplex_vertex_range(f_simplex)) {
- std::cout << vertex << " ";
- }
- std::cout << ") -> "
- << "[" << stree.filtration(f_simplex) << "] ";
- std::cout << std::endl;
- }
- return 0;
-}
diff --git a/example/Cech_complex/cech_complex_example_from_points_for_doc.txt b/example/Cech_complex/cech_complex_example_from_points_for_doc.txt
deleted file mode 100644
index be0afc76..00000000
--- a/example/Cech_complex/cech_complex_example_from_points_for_doc.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-Iterator on Cech complex simplices in the filtration order, with [filtration value]:
- ( 0 ) -> [0]
- ( 1 ) -> [0]
- ( 2 ) -> [0]
- ( 3 ) -> [0]
- ( 4 ) -> [0]
- ( 5 ) -> [0]
- ( 6 ) -> [0]
- ( 7 ) -> [0]
- ( 8 ) -> [0]
- ( 9 ) -> [0]
- ( 10 ) -> [0]
- ( 9 4 ) -> [0.5]
- ( 9 6 ) -> [0.5]
- ( 10 1 ) -> [0.559017]
- ( 10 4 ) -> [0.559017]
- ( 1 0 ) -> [0.707107]
- ( 2 0 ) -> [0.707107]
- ( 3 2 ) -> [0.707107]
- ( 6 4 ) -> [0.707107]
- ( 9 6 4 ) -> [0.707107]
- ( 2 1 ) -> [1]
- ( 2 1 0 ) -> [1]
- ( 4 1 ) -> [1]
- ( 5 3 ) -> [1]
- ( 7 3 ) -> [1]
- ( 7 5 ) -> [1]
- ( 7 6 ) -> [1]
- ( 8 6 ) -> [1]
- ( 8 7 ) -> [1]
- ( 10 4 1 ) -> [1]
diff --git a/example/Cech_complex/cech_complex_step_by_step.cpp b/example/Cech_complex/cech_complex_step_by_step.cpp
deleted file mode 100644
index 6fbbde5b..00000000
--- a/example/Cech_complex/cech_complex_step_by_step.cpp
+++ /dev/null
@@ -1,166 +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.
- *
- * Author(s): Vincent Rouvreau
- *
- * Copyright (C) 2018 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/graph_simplicial_complex.h>
-#include <gudhi/distance_functions.h>
-#include <gudhi/Simplex_tree.h>
-#include <gudhi/Points_off_io.h>
-
-#include <gudhi/Miniball.hpp>
-
-#include <boost/program_options.hpp>
-
-#include <string>
-#include <vector>
-#include <limits> // infinity
-#include <utility> // for pair
-#include <map>
-
-// ----------------------------------------------------------------------------
-// rips_persistence_step_by_step is an example of each step that is required to
-// build a Rips over a Simplex_tree. Please refer to rips_persistence to see
-// how to do the same thing with the Rips_complex wrapper for less detailed
-// steps.
-// ----------------------------------------------------------------------------
-
-// Types definition
-using Simplex_tree = Gudhi::Simplex_tree<>;
-using Simplex_handle = Simplex_tree::Simplex_handle;
-using Filtration_value = Simplex_tree::Filtration_value;
-using Point = std::vector<double>;
-using Points_off_reader = Gudhi::Points_off_reader<Point>;
-using Proximity_graph = Gudhi::Proximity_graph<Simplex_tree>;
-
-class Cech_blocker {
- private:
- using Point_cloud = std::vector<Point>;
- using Point_iterator = Point_cloud::const_iterator;
- using Coordinate_iterator = Point::const_iterator;
- using Min_sphere = Gudhi::Miniball::Miniball<Gudhi::Miniball::CoordAccessor<Point_iterator, Coordinate_iterator>>;
-
- public:
- bool operator()(Simplex_handle sh) {
- std::vector<Point> points;
- for (auto vertex : simplex_tree_.simplex_vertex_range(sh)) {
- points.push_back(point_cloud_[vertex]);
-#ifdef DEBUG_TRACES
- std::cout << "#(" << vertex << ")#";
-#endif // DEBUG_TRACES
- }
- Filtration_value radius = Gudhi::Minimal_enclosing_ball_radius()(points);
-#ifdef DEBUG_TRACES
- std::cout << "radius = " << radius << " - " << (radius > max_radius_) << std::endl;
-#endif // DEBUG_TRACES
- simplex_tree_.assign_filtration(sh, radius);
- return (radius > max_radius_);
- }
- Cech_blocker(Simplex_tree& simplex_tree, Filtration_value max_radius, const std::vector<Point>& point_cloud)
- : simplex_tree_(simplex_tree), max_radius_(max_radius), point_cloud_(point_cloud) {
- dimension_ = point_cloud_[0].size();
- }
-
- private:
- Simplex_tree simplex_tree_;
- Filtration_value max_radius_;
- std::vector<Point> point_cloud_;
- int dimension_;
-};
-
-void program_options(int argc, char* argv[], std::string& off_file_points, Filtration_value& max_radius, int& dim_max);
-
-int main(int argc, char* argv[]) {
- std::string off_file_points;
- Filtration_value max_radius;
- int dim_max;
-
- program_options(argc, argv, off_file_points, max_radius, dim_max);
-
- // Extract the points from the file filepoints
- Points_off_reader off_reader(off_file_points);
-
- // Compute the proximity graph of the points
- Proximity_graph prox_graph = Gudhi::compute_proximity_graph<Simplex_tree>(off_reader.get_point_cloud(), max_radius,
- Gudhi::Minimal_enclosing_ball_radius());
-
- // Construct the Rips complex in a Simplex Tree
- Simplex_tree st;
- // insert the proximity graph in the simplex tree
- st.insert_graph(prox_graph);
- // expand the graph until dimension dim_max
- st.expansion_with_blockers(dim_max, Cech_blocker(st, max_radius, off_reader.get_point_cloud()));
-
- std::cout << "The complex contains " << st.num_simplices() << " simplices \n";
- std::cout << " and has dimension " << st.dimension() << " \n";
-
- // Sort the simplices in the order of the filtration
- st.initialize_filtration();
-
-#if DEBUG_TRACES
- std::cout << "********************************************************************\n";
- std::cout << "* The complex contains " << st.num_simplices() << " simplices - dimension=" << st.dimension() << "\n";
- std::cout << "* Iterator on Simplices in the filtration, with [filtration value]:\n";
- for (auto f_simplex : st.filtration_simplex_range()) {
- std::cout << " "
- << "[" << st.filtration(f_simplex) << "] ";
- for (auto vertex : st.simplex_vertex_range(f_simplex)) {
- std::cout << static_cast<int>(vertex) << " ";
- }
- std::cout << std::endl;
- }
-#endif // DEBUG_TRACES
-
- return 0;
-}
-
-void program_options(int argc, char* argv[], std::string& off_file_points, Filtration_value& max_radius, int& dim_max) {
- namespace po = boost::program_options;
- po::options_description hidden("Hidden options");
- hidden.add_options()("input-file", po::value<std::string>(&off_file_points),
- "Name of an OFF file containing a point set.\n");
-
- po::options_description visible("Allowed options", 100);
- visible.add_options()("help,h", "produce help message")(
- "max-radius,r",
- po::value<Filtration_value>(&max_radius)->default_value(std::numeric_limits<Filtration_value>::infinity()),
- "Maximal length of an edge for the Rips complex construction.")(
- "cpx-dimension,d", po::value<int>(&dim_max)->default_value(1),
- "Maximal dimension of the Rips complex we want to compute.");
-
- po::positional_options_description pos;
- pos.add("input-file", 1);
-
- po::options_description all;
- all.add(visible).add(hidden);
-
- po::variables_map vm;
- po::store(po::command_line_parser(argc, argv).options(all).positional(pos).run(), vm);
- po::notify(vm);
-
- if (vm.count("help") || !vm.count("input-file")) {
- std::cout << std::endl;
- std::cout << "Construct a Cech complex defined on a set of input points.\n \n";
-
- std::cout << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl;
- std::cout << visible << std::endl;
- exit(-1);
- }
-}
diff --git a/example/Contraction/CMakeLists.txt b/example/Contraction/CMakeLists.txt
deleted file mode 100644
index 582b7ab8..00000000
--- a/example/Contraction/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-project(Contraction_examples)
-
-add_executable(RipsContraction Rips_contraction.cpp)
-
-add_executable(GarlandHeckbert Garland_heckbert.cpp)
-target_link_libraries(GarlandHeckbert ${Boost_TIMER_LIBRARY})
-
-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(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")
-
-install(TARGETS RipsContraction DESTINATION bin)
-install(TARGETS GarlandHeckbert DESTINATION bin)
diff --git a/example/Contraction/Garland_heckbert.cpp b/example/Contraction/Garland_heckbert.cpp
deleted file mode 100644
index 08dd932e..00000000
--- a/example/Contraction/Garland_heckbert.cpp
+++ /dev/null
@@ -1,192 +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.
- *
- * Author(s): David Salinas
- *
- * Copyright (C) 2014 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 GARLAND_HECKBERT_H_
-#define GARLAND_HECKBERT_H_
-
-#include <gudhi/Point.h>
-#include <gudhi/Edge_contraction.h>
-#include <gudhi/Skeleton_blocker.h>
-#include <gudhi/Off_reader.h>
-
-#include <iostream>
-
-#include "Garland_heckbert/Error_quadric.h"
-
-struct Geometry_trait {
- typedef Point_d Point;
-};
-
-/**
- * The vertex stored in the complex contains a quadric.
- */
-struct Garland_heckbert_traits
- : public Gudhi::skeleton_blocker::Skeleton_blocker_simple_geometric_traits<Geometry_trait> {
- public:
- struct Garland_heckbert_vertex : public Simple_geometric_vertex {
- Error_quadric<Geometry_trait::Point> quadric;
- };
- typedef Garland_heckbert_vertex Graph_vertex;
-};
-
-using Complex = Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex< Garland_heckbert_traits >;
-using EdgeProfile = Gudhi::contraction::Edge_profile<Complex>;
-using Complex_contractor = Gudhi::contraction::Skeleton_blocker_contractor<Complex>;
-
-/**
- * How the new vertex is placed after an edge collapse : here it is placed at
- * the point minimizing the cost of the quadric.
- */
-class GH_placement : public Gudhi::contraction::Placement_policy<EdgeProfile> {
- Complex& complex_;
-
- public:
- typedef Gudhi::contraction::Placement_policy<EdgeProfile>::Placement_type Placement_type;
-
- GH_placement(Complex& complex) : complex_(complex) { (void)complex_; }
-
- Placement_type operator()(const EdgeProfile& profile) const override {
- auto sum_quad(profile.v0().quadric);
- sum_quad += profile.v1().quadric;
-
- boost::optional<Point> min_quadric_pt(sum_quad.min_cost());
- if (min_quadric_pt)
- return Placement_type(*min_quadric_pt);
- else
- return profile.p0();
- }
-};
-
-/**
- * How much cost an edge collapse : here the costs is given by a quadric
- * which expresses a squared distances with triangles planes.
- */
-class GH_cost : public Gudhi::contraction::Cost_policy<EdgeProfile> {
- Complex& complex_;
-
- public:
- typedef Gudhi::contraction::Cost_policy<EdgeProfile>::Cost_type Cost_type;
-
- GH_cost(Complex& complex) : complex_(complex) { (void)complex_; }
-
- Cost_type operator()(EdgeProfile const& profile, boost::optional<Point> const& new_point) const override {
- Cost_type res;
- if (new_point) {
- auto sum_quad(profile.v0().quadric);
- sum_quad += profile.v1().quadric;
- res = sum_quad.cost(*new_point);
- }
- return res;
- }
-};
-
-/**
- * Visitor that is called at several moment.
- * Here we initializes the quadrics of every vertex at the on_started call back
- * and we update them when contracting an edge (the quadric become the sum of both quadrics).
- */
-class GH_visitor : public Gudhi::contraction::Contraction_visitor<EdgeProfile> {
- Complex& complex_;
-
- public:
- GH_visitor(Complex& complex) : complex_(complex) { (void)complex_; }
-
- // Compute quadrics for every vertex v
- // The quadric of v consists in the sum of quadric
- // of every triangles passing through v weighted by its area
-
- void on_started(Complex & complex) override {
- for (auto v : complex.vertex_range()) {
- auto & quadric_v(complex[v].quadric);
- for (auto t : complex.triangle_range(v)) {
- auto t_it = t.begin();
- const auto& p0(complex.point(*t_it++));
- const auto& p1(complex.point(*t_it++));
- const auto& p2(complex.point(*t_it++));
- quadric_v += Error_quadric<Point>(p0, p1, p2);
- }
- }
- }
-
- /**
- * @brief Called when an edge is about to be contracted and replaced by a vertex whose position is *placement.
- */
- void on_contracting(EdgeProfile const &profile, boost::optional< Point > placement)
- override {
- profile.v0().quadric += profile.v1().quadric;
- }
-};
-
-int main(int argc, char *argv[]) {
- if (argc != 4) {
- std::cerr << "Usage " << argv[0] <<
- " input.off output.off N to load the file input.off, contract N edges and save the result to output.off.\n";
- return EXIT_FAILURE;
- }
-
- Complex complex;
- typedef Complex::Vertex_handle Vertex_handle;
-
- // load the points
- Gudhi::skeleton_blocker::Skeleton_blocker_off_reader<Complex> off_reader(argv[1], complex);
- if (!off_reader.is_valid()) {
- std::cerr << "Unable to read file:" << argv[1] << std::endl;
- return EXIT_FAILURE;
- }
-
- if (!complex.empty() && !(complex.point(Vertex_handle(0)).dimension() == 3)) {
- std::cerr << "Only points of dimension 3 are supported." << std::endl;
- return EXIT_FAILURE;
- }
-
- std::cout << "Load complex with " << complex.num_vertices() << " vertices" << std::endl;
-
- int num_contractions = atoi(argv[3]);
-
- // constructs the contractor object with Garland Heckbert policies.
- Complex_contractor contractor(complex,
- new GH_cost(complex),
- new GH_placement(complex),
- Gudhi::contraction::make_link_valid_contraction<EdgeProfile>(),
- new GH_visitor(complex));
-
- std::cout << "Contract " << num_contractions << " edges" << std::endl;
- contractor.contract_edges(num_contractions);
-
- std::cout << "Final complex has " <<
- complex.num_vertices() << " vertices, " <<
- complex.num_edges() << " edges and " <<
- complex.num_triangles() << " triangles." << std::endl;
-
- // write simplified complex
- Gudhi::skeleton_blocker::Skeleton_blocker_off_writer<Complex> off_writer(argv[2], complex);
-
- return EXIT_SUCCESS;
-}
-
-#endif // GARLAND_HECKBERT_H_
-
-
-
-
diff --git a/example/Contraction/Garland_heckbert/Error_quadric.h b/example/Contraction/Garland_heckbert/Error_quadric.h
deleted file mode 100644
index 8bd9b545..00000000
--- a/example/Contraction/Garland_heckbert/Error_quadric.h
+++ /dev/null
@@ -1,182 +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.
- *
- * Author(s): David Salinas
- *
- * Copyright (C) 2014 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 GARLAND_HECKBERT_ERROR_QUADRIC_H_
-#define GARLAND_HECKBERT_ERROR_QUADRIC_H_
-
-#include <boost/optional/optional.hpp>
-
-#include <vector>
-#include <utility>
-
-template <typename Point> class Error_quadric {
- private:
- double coeff[10];
-
- public:
- Error_quadric() {
- clear();
- }
-
- /**
- * Quadric corresponding to the L2 distance to the plane.
- *
- * According to the notation of Garland Heckbert, they
- * denote a quadric symetric matrix as :
- * Q = [ q11 q12 q13 q14]
- * [ q12 q22 q23 q24]
- * [ q13 q23 q33 q34]
- * [ q14 q24 q34 q44]
- *
- * which is represented by a vector with 10 elts that
- * are denoted ci for clarity with :
- * Q = [ c0 c1 c2 c3 ]
- * [ c1 c4 c5 c6 ]
- * [ c2 c5 c7 c8 ]
- * [ c3 c6 c8 c9 ]
- *
- * The constructor return the quadrics that represents
- * the squared distance to the plane defined by triangle p0,p1,p2
- * times the area of triangle p0,p1,p2.
- */
- Error_quadric(const Point & p0, const Point & p1, const Point & p2) {
- Point normal(unit_normal(p0, p1, p2));
- double a = normal[0];
- double b = normal[1];
- double c = normal[2];
- double d = -a * p0[0] - b * p0[1] - c * p0[2];
- coeff[0] = a*a;
- coeff[1] = a*b;
- coeff[2] = a*c;
- coeff[3] = a*d;
- coeff[4] = b*b;
- coeff[5] = b*c;
- coeff[6] = b*d;
- coeff[7] = c*c;
- coeff[8] = c*d;
- coeff[9] = d*d;
-
- double area_p0p1p2 = std::sqrt(squared_area(p0, p1, p2));
- for (auto& x : coeff)
- x *= area_p0p1p2;
- }
-
- inline double squared_area(const Point& p0, const Point& p1, const Point& p2) {
- // if (x1,x2,x3) = p1-p0 and (y1,y2,y3) = p2-p0
- // then the squared area is = (u^2+v^2+w^2)/4
- // with: u = x2 * y3 - x3 * y2;
- // v = x3 * y1 - x1 * y3;
- // w = x1 * y2 - x2 * y1;
- Point p0p1(p1 - p0);
- Point p0p2(p2 - p0);
- double A = p0p1[1] * p0p2[2] - p0p1[2] * p0p2[1];
- double B = p0p1[2] * p0p2[0] - p0p1[0] * p0p2[2];
- double C = p0p1[0] * p0p2[1] - p0p1[1] * p0p2[0];
- return 1. / 4. * (A * A + B * B + C * C);
- }
-
- void clear() {
- for (auto& x : coeff)
- x = 0;
- }
-
- Error_quadric& operator+=(const Error_quadric& other) {
- if (this != &other) {
- for (int i = 0; i < 10; ++i)
- coeff[i] += other.coeff[i];
- }
- return *this;
- }
-
- /**
- * @return The quadric quost defined by the scalar product v^T Q v where Q is the quadratic form of Garland/Heckbert
- */
- inline double cost(const Point& point) const {
- double cost =
- coeff[0] * point.x() * point.x() + coeff[4] * point.y() * point.y() + coeff[7] * point.z() * point.z()
- + 2 * (coeff[1] * point.x() * point.y() + coeff[5] * point.y() * point.z() + coeff[2] * point.z() * point.x())
- + 2 * (coeff[3] * point.x() + coeff[6] * point.y() + coeff[8] * point.z())
- + coeff[9];
- if (cost < 0) {
- return 0;
- } else {
- return cost;
- }
- }
-
- inline double grad_determinant() const {
- return
- coeff[0] * coeff[4] * coeff[7]
- - coeff[0] * coeff[5] * coeff[5]
- - coeff[1] * coeff[1] * coeff[7]
- + 2 * coeff[1] * coeff[5] * coeff[2]
- - coeff[4] * coeff[2] * coeff[2];
- }
-
- /**
- * Return the point such that it minimizes the gradient of the quadric.
- * Det must be passed with the determinant value of the gradient (should be non zero).
- */
- inline Point solve_linear_gradient(double det) const {
- return Point({
- (-coeff[1] * coeff[5] * coeff[8] + coeff[1] * coeff[7] * coeff[6] + coeff[2] * coeff[8] * coeff[4] -
- coeff[2] * coeff[5] * coeff[6] - coeff[3] * coeff[4] * coeff[7] + coeff[3] * coeff[5] * coeff[5])
- / det,
- (coeff[0] * coeff[5] * coeff[8] - coeff[0] * coeff[7] * coeff[6] - coeff[5] * coeff[2] * coeff[3] -
- coeff[1] * coeff[2] * coeff[8] + coeff[6] * coeff[2] * coeff[2] + coeff[1] * coeff[3] * coeff[7])
- / det,
- (-coeff[8] * coeff[0] * coeff[4] + coeff[8] * coeff[1] * coeff[1] + coeff[2] * coeff[3] * coeff[4] +
- coeff[5] * coeff[0] * coeff[6] - coeff[5] * coeff[1] * coeff[3] - coeff[1] * coeff[2] * coeff[6])
- / det
- });
- }
-
- /**
- * returns the point that minimizes the quadric.
- * It inverses the quadric if its determinant is higher that a given threshold .
- * If the determinant is lower than this value the returned value is uninitialized.
- */
- boost::optional<Point> min_cost(double scale = 1) const {
- // const double min_determinant = 1e-4 * scale*scale;
- const double min_determinant = 1e-5;
- boost::optional<Point> pt_res;
- double det = grad_determinant();
- if (std::abs(det) > min_determinant)
- pt_res = solve_linear_gradient(det);
- return pt_res;
- }
-
- friend std::ostream& operator<<(std::ostream& stream, const Error_quadric& quadric) {
- stream << "\n[ " << quadric.coeff[0] << "," << quadric.coeff[1] << "," << quadric.coeff[2] << "," <<
- quadric.coeff[3] << ";\n";
- stream << " " << quadric.coeff[1] << "," << quadric.coeff[4] << "," << quadric.coeff[5] << "," <<
- quadric.coeff[6] << ";\n";
- stream << " " << quadric.coeff[2] << "," << quadric.coeff[5] << "," << quadric.coeff[7] << "," <<
- quadric.coeff[8] << ";\n";
- stream << " " << quadric.coeff[3] << "," << quadric.coeff[6] << "," << quadric.coeff[8] << "," <<
- quadric.coeff[9] << "]";
- return stream;
- }
-};
-
-#endif // GARLAND_HECKBERT_ERROR_QUADRIC_H_
diff --git a/example/Contraction/Rips_contraction.cpp b/example/Contraction/Rips_contraction.cpp
deleted file mode 100644
index 7f9b150a..00000000
--- a/example/Contraction/Rips_contraction.cpp
+++ /dev/null
@@ -1,98 +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.
- *
- * Author(s): David Salinas
- *
- * Copyright (C) 2014 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/Edge_contraction.h>
-#include <gudhi/Skeleton_blocker.h>
-#include <gudhi/Off_reader.h>
-#include <gudhi/Point.h>
-#include <gudhi/Clock.h>
-
-#include <iostream>
-
-struct Geometry_trait {
- typedef Point_d Point;
-};
-
-using Complex_geometric_traits = Gudhi::skeleton_blocker::Skeleton_blocker_simple_geometric_traits<Geometry_trait>;
-using Complex = Gudhi::skeleton_blocker::Skeleton_blocker_geometric_complex< Complex_geometric_traits >;
-using Profile = Gudhi::contraction::Edge_profile<Complex>;
-using Complex_contractor = Gudhi::contraction::Skeleton_blocker_contractor<Complex>;
-
-
-template<typename ComplexType>
-void build_rips(ComplexType& complex, double offset) {
- if (offset <= 0) return;
- auto vertices = complex.vertex_range();
- for (auto p = vertices.begin(); p != vertices.end(); ++p)
- for (auto q = p; ++q != vertices.end(); /**/) {
- if (squared_dist(complex.point(*p), complex.point(*q)) < 4 * offset * offset)
- complex.add_edge_without_blockers(*p, *q);
- }
-}
-
-int main(int argc, char *argv[]) {
- if (argc != 3) {
- std::cerr << "Usage " << argv[0] << " ../../../data/meshes/SO3_10000.off 0.3 to load the file " <<
- "../../data/SO3_10000.off and contract the Rips complex built with paremeter 0.3.\n";
- return -1;
- }
-
- Complex complex;
-
- // load only the points
- Gudhi::skeleton_blocker::Skeleton_blocker_off_reader<Complex> off_reader(argv[1], complex, true);
- if (!off_reader.is_valid()) {
- std::cerr << "Unable to read file:" << argv[1] << std::endl;
- return EXIT_FAILURE;
- }
-
- std::cout << "Build the Rips complex with " << complex.num_vertices() << " vertices" << std::endl;
-
- build_rips(complex, atof(argv[2]));
-
- Gudhi::Clock contraction_chrono("Time to simplify and enumerate simplices");
-
- std::cout << "Initial complex has " <<
- complex.num_vertices() << " vertices and " <<
- complex.num_edges() << " edges" << std::endl;
-
- Complex_contractor contractor(complex,
- new Gudhi::contraction::Edge_length_cost<Profile>,
- Gudhi::contraction::make_first_vertex_placement<Profile>(),
- Gudhi::contraction::make_link_valid_contraction<Profile>(),
- Gudhi::contraction::make_remove_popable_blockers_visitor<Profile>());
- contractor.contract_edges();
-
- std::cout << "Counting final number of simplices \n";
- unsigned num_simplices = std::distance(complex.complex_simplex_range().begin(), complex.complex_simplex_range().end());
-
- std::cout << "Final complex has " <<
- complex.num_vertices() << " vertices, " <<
- complex.num_edges() << " edges, " <<
- complex.num_blockers() << " blockers and " <<
- num_simplices << " simplices" << std::endl;
-
- std::cout << contraction_chrono;
-
- return EXIT_SUCCESS;
-}
-
-
diff --git a/example/Nerve_GIC/CMakeLists.txt b/example/Nerve_GIC/CMakeLists.txt
deleted file mode 100644
index fdecf86e..00000000
--- a/example/Nerve_GIC/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-project(Nerve_GIC_examples)
-
-if (NOT CGAL_VERSION VERSION_LESS 4.8.1)
-
- add_executable ( CoordGIC CoordGIC.cpp )
- add_executable ( FuncGIC FuncGIC.cpp )
-
- if (TBB_FOUND)
- target_link_libraries(CoordGIC ${TBB_LIBRARIES})
- target_link_libraries(FuncGIC ${TBB_LIBRARIES})
- endif()
-
- # Copy files for not to pollute sources when testing
- file(COPY "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
- file(COPY "${CMAKE_SOURCE_DIR}/data/points/COIL_database/lucky_cat.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
- file(COPY "${CMAKE_SOURCE_DIR}/data/points/COIL_database/lucky_cat_PCA1" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
-
- add_test(NAME Nerve_GIC_example_CoordGIC COMMAND $<TARGET_FILE:CoordGIC>
- "${CMAKE_CURRENT_BINARY_DIR}/tore3D_1307.off" "0")
-
- add_test(NAME Nerve_GIC_example_FuncGIC COMMAND $<TARGET_FILE:FuncGIC>
- "${CMAKE_CURRENT_BINARY_DIR}/lucky_cat.off"
- "${CMAKE_CURRENT_BINARY_DIR}/lucky_cat_PCA1")
-
- install(TARGETS CoordGIC DESTINATION bin)
- install(TARGETS FuncGIC DESTINATION bin)
-
-endif (NOT CGAL_VERSION VERSION_LESS 4.8.1)
diff --git a/example/Nerve_GIC/CoordGIC.cpp b/example/Nerve_GIC/CoordGIC.cpp
deleted file mode 100644
index 9889b198..00000000
--- a/example/Nerve_GIC/CoordGIC.cpp
+++ /dev/null
@@ -1,96 +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.
- *
- * Author(s): Mathieu Carrière
- *
- * 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/>.
- */
-
-#include <gudhi/GIC.h>
-
-#include <string>
-#include <vector>
-
-void usage(int nbArgs, char *const progName) {
- std::cerr << "Error: Number of arguments (" << nbArgs << ") is not correct\n";
- std::cerr << "Usage: " << progName << " filename.off coordinate [-v] \n";
- std::cerr << " i.e.: " << progName << " ../../data/points/human.off 2 -v \n";
- exit(-1); // ----- >>
-}
-
-int main(int argc, char **argv) {
- if ((argc != 3) && (argc != 4)) usage(argc, argv[0]);
-
- using Point = std::vector<float>;
-
- std::string off_file_name(argv[1]);
- int coord = atoi(argv[2]);
- bool verb = 0;
- if (argc == 4) verb = 1;
-
- // -----------------------------------------
- // Init of a functional GIC from an OFF file
- // -----------------------------------------
-
- Gudhi::cover_complex::Cover_complex<Point> GIC;
- GIC.set_verbose(verb);
-
- bool check = GIC.read_point_cloud(off_file_name);
-
- if (!check) {
- std::cout << "Incorrect OFF file." << std::endl;
- } else {
- GIC.set_type("GIC");
-
- GIC.set_color_from_coordinate(coord);
- GIC.set_function_from_coordinate(coord);
-
- GIC.set_graph_from_automatic_rips(Gudhi::Euclidean_distance());
- GIC.set_automatic_resolution();
- GIC.set_gain();
- GIC.set_cover_from_function();
-
- GIC.find_simplices();
-
- GIC.compute_distribution(10);
- GIC.compute_p_value();
-
- GIC.plot_DOT();
-
- Gudhi::Simplex_tree<> stree;
- GIC.create_complex(stree);
-
- // --------------------------------------------
- // Display information about the functional GIC
- // --------------------------------------------
-
- if (verb) {
- std::cout << "Coordinate GIC is of dimension " << stree.dimension() << " - " << stree.num_simplices()
- << " simplices - " << stree.num_vertices() << " vertices." << std::endl;
-
- std::cout << "Iterator on coordinate GIC simplices" << std::endl;
- for (auto f_simplex : stree.filtration_simplex_range()) {
- for (auto vertex : stree.simplex_vertex_range(f_simplex)) {
- std::cout << vertex << " ";
- }
- std::cout << std::endl;
- }
- }
- }
-
- return 0;
-}
diff --git a/example/Nerve_GIC/FuncGIC.cpp b/example/Nerve_GIC/FuncGIC.cpp
deleted file mode 100644
index 1f5de999..00000000
--- a/example/Nerve_GIC/FuncGIC.cpp
+++ /dev/null
@@ -1,94 +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.
- *
- * Author(s): Mathieu Carrière
- *
- * 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/>.
- */
-
-#include <gudhi/GIC.h>
-
-#include <string>
-#include <vector>
-
-void usage(int nbArgs, char *const progName) {
- std::cerr << "Error: Number of arguments (" << nbArgs << ") is not correct\n";
- std::cerr << "Usage: " << progName << " filename.off function [-v] \n";
- std::cerr << " i.e.: " << progName << " ../../data/points/COIL_database/lucky_cat.off "
- "../../data/points/COIL_database/lucky_cat_PCA1 -v \n";
- exit(-1); // ----- >>
-}
-
-int main(int argc, char **argv) {
- if ((argc != 3) && (argc != 4)) usage(argc, argv[0]);
-
- using Point = std::vector<float>;
-
- std::string off_file_name(argv[1]);
- std::string func_file_name = argv[2];
- bool verb = 0;
- if (argc == 4) verb = 1;
-
- // -----------------------------------------
- // Init of a functional GIC from an OFF file
- // -----------------------------------------
-
- Gudhi::cover_complex::Cover_complex<Point> GIC;
- GIC.set_verbose(verb);
-
- bool check = GIC.read_point_cloud(off_file_name);
-
- if (!check) {
- std::cout << "Incorrect OFF file." << std::endl;
- } else {
- GIC.set_type("GIC");
-
- GIC.set_color_from_file(func_file_name);
- GIC.set_function_from_file(func_file_name);
-
- GIC.set_graph_from_automatic_rips(Gudhi::Euclidean_distance());
- GIC.set_automatic_resolution();
- GIC.set_gain();
- GIC.set_cover_from_function();
-
- GIC.find_simplices();
-
- GIC.plot_DOT();
-
- Gudhi::Simplex_tree<> stree;
- GIC.create_complex(stree);
-
- // --------------------------------------------
- // Display information about the functional GIC
- // --------------------------------------------
-
- if (verb) {
- std::cout << "Functional GIC is of dimension " << stree.dimension() << " - " << stree.num_simplices()
- << " simplices - " << stree.num_vertices() << " vertices." << std::endl;
-
- std::cout << "Iterator on functional GIC simplices" << std::endl;
- for (auto f_simplex : stree.filtration_simplex_range()) {
- for (auto vertex : stree.simplex_vertex_range(f_simplex)) {
- std::cout << vertex << " ";
- }
- std::cout << std::endl;
- }
- }
- }
-
- return 0;
-}
diff --git a/example/Persistence_representations/CMakeLists.txt b/example/Persistence_representations/CMakeLists.txt
deleted file mode 100644
index 33558df3..00000000
--- a/example/Persistence_representations/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-project(Persistence_representations_example)
-
-add_executable ( Persistence_representations_example_landscape_on_grid persistence_landscape_on_grid.cpp )
-add_test(NAME Persistence_representations_example_landscape_on_grid
- COMMAND $<TARGET_FILE:Persistence_representations_example_landscape_on_grid>)
-install(TARGETS Persistence_representations_example_landscape_on_grid DESTINATION bin)
-
-add_executable ( Persistence_representations_example_landscape persistence_landscape.cpp )
-add_test(NAME Persistence_representations_example_landscape
- COMMAND $<TARGET_FILE:Persistence_representations_example_landscape>)
-install(TARGETS Persistence_representations_example_landscape DESTINATION bin)
-
-add_executable ( Persistence_representations_example_intervals persistence_intervals.cpp )
-add_test(NAME Persistence_representations_example_intervals
- COMMAND $<TARGET_FILE:Persistence_representations_example_intervals>
- "${CMAKE_SOURCE_DIR}/data/persistence_diagram/first.pers")
-install(TARGETS Persistence_representations_example_intervals DESTINATION bin)
-
-add_executable ( Persistence_representations_example_vectors persistence_vectors.cpp )
-add_test(NAME Persistence_representations_example_vectors
- COMMAND $<TARGET_FILE:Persistence_representations_example_vectors>)
-install(TARGETS Persistence_representations_example_vectors DESTINATION bin)
-
-add_executable ( Persistence_representations_example_heat_maps persistence_heat_maps.cpp )
-add_test(NAME Persistence_representations_example_heat_maps
- COMMAND $<TARGET_FILE:Persistence_representations_example_heat_maps>)
-install(TARGETS Persistence_representations_example_heat_maps DESTINATION bin)
-
diff --git a/example/Persistence_representations/persistence_heat_maps.cpp b/example/Persistence_representations/persistence_heat_maps.cpp
deleted file mode 100644
index 323b57e9..00000000
--- a/example/Persistence_representations/persistence_heat_maps.cpp
+++ /dev/null
@@ -1,80 +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.
- *
- * Author(s): Pawel Dlotko
- *
- * Copyright (C) 2016 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/Persistence_heat_maps.h>
-
-#include <iostream>
-#include <vector>
-#include <utility>
-
-using constant_scaling_function = Gudhi::Persistence_representations::constant_scaling_function;
-using Persistence_heat_maps = Gudhi::Persistence_representations::Persistence_heat_maps<constant_scaling_function>;
-
-int main(int argc, char** argv) {
- // create two simple vectors with birth--death pairs:
-
- std::vector<std::pair<double, double> > persistence1;
- std::vector<std::pair<double, double> > persistence2;
-
- persistence1.push_back(std::make_pair(1, 2));
- persistence1.push_back(std::make_pair(6, 8));
- persistence1.push_back(std::make_pair(0, 4));
- persistence1.push_back(std::make_pair(3, 8));
-
- persistence2.push_back(std::make_pair(2, 9));
- persistence2.push_back(std::make_pair(1, 6));
- persistence2.push_back(std::make_pair(3, 5));
- persistence2.push_back(std::make_pair(6, 10));
-
- // over here we define a function we sill put on a top on every birth--death pair in the persistence interval. It can
- // be anything. Over here we will use standard Gaussian
- std::vector<std::vector<double> > filter = Gudhi::Persistence_representations::create_Gaussian_filter(5, 1);
-
- // creating two heat maps.
- Persistence_heat_maps hm1(persistence1, filter, false, 20, 0, 11);
- Persistence_heat_maps hm2(persistence2, filter, false, 20, 0, 11);
-
- std::vector<Persistence_heat_maps*> vector_of_maps;
- vector_of_maps.push_back(&hm1);
- vector_of_maps.push_back(&hm2);
-
- // compute median/mean of a vector of heat maps:
- Persistence_heat_maps mean;
- mean.compute_mean(vector_of_maps);
- Persistence_heat_maps median;
- median.compute_median(vector_of_maps);
-
- // to compute L^1 distance between hm1 and hm2:
- std::cout << "The L^1 distance is : " << hm1.distance(hm2, 1) << std::endl;
-
- // to average of hm1 and hm2:
- std::vector<Persistence_heat_maps*> to_average;
- to_average.push_back(&hm1);
- to_average.push_back(&hm2);
- Persistence_heat_maps av;
- av.compute_average(to_average);
-
- // to compute scalar product of hm1 and hm2:
- std::cout << "Scalar product is : " << hm1.compute_scalar_product(hm2) << std::endl;
-
- return 0;
-}
diff --git a/example/Persistence_representations/persistence_intervals.cpp b/example/Persistence_representations/persistence_intervals.cpp
deleted file mode 100644
index b5dcf25c..00000000
--- a/example/Persistence_representations/persistence_intervals.cpp
+++ /dev/null
@@ -1,89 +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.
- *
- * Author(s): Pawel Dlotko
- *
- * Copyright (C) 2016 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/Persistence_intervals.h>
-
-#include <iostream>
-#include <utility>
-#include <vector>
-
-using Persistence_intervals = Gudhi::Persistence_representations::Persistence_intervals;
-
-int main(int argc, char** argv) {
- if (argc != 2) {
- std::cout << "To run this program, please provide the name of a file with persistence diagram \n";
- return 1;
- }
-
- Persistence_intervals p(argv[1]);
- std::pair<double, double> min_max_ = p.get_x_range();
- std::cout << "Birth-death range : " << min_max_.first << " " << min_max_.second << std::endl;
-
- std::vector<double> dominant_ten_intervals_length = p.length_of_dominant_intervals(10);
- std::cout << "Length of ten dominant intervals : " << std::endl;
- for (size_t i = 0; i != dominant_ten_intervals_length.size(); ++i) {
- std::cout << dominant_ten_intervals_length[i] << std::endl;
- }
-
- std::vector<std::pair<double, double> > ten_dominant_intervals = p.dominant_intervals(10);
- std::cout << "Here are the dominant intervals : " << std::endl;
- for (size_t i = 0; i != ten_dominant_intervals.size(); ++i) {
- std::cout << "( " << ten_dominant_intervals[i].first << "," << ten_dominant_intervals[i].second << std::endl;
- }
-
- std::vector<size_t> histogram = p.histogram_of_lengths(10);
- std::cout << "Here is the histogram of barcode's length : " << std::endl;
- for (size_t i = 0; i != histogram.size(); ++i) {
- std::cout << histogram[i] << " ";
- }
- std::cout << std::endl;
-
- std::vector<size_t> cumulative_histogram = p.cumulative_histogram_of_lengths(10);
- std::cout << "Cumulative histogram : " << std::endl;
- for (size_t i = 0; i != cumulative_histogram.size(); ++i) {
- std::cout << cumulative_histogram[i] << " ";
- }
- std::cout << std::endl;
-
- std::vector<double> char_funct_diag = p.characteristic_function_of_diagram(min_max_.first, min_max_.second);
- std::cout << "Characteristic function of diagram : " << std::endl;
- for (size_t i = 0; i != char_funct_diag.size(); ++i) {
- std::cout << char_funct_diag[i] << " ";
- }
- std::cout << std::endl;
-
- std::vector<double> cumul_char_funct_diag =
- p.cumulative_characteristic_function_of_diagram(min_max_.first, min_max_.second);
- std::cout << "Cumulative characteristic function of diagram : " << std::endl;
- for (size_t i = 0; i != cumul_char_funct_diag.size(); ++i) {
- std::cout << cumul_char_funct_diag[i] << " ";
- }
- std::cout << std::endl;
-
- std::cout << "Persistence Betti numbers \n";
- std::vector<std::pair<double, size_t> > pbns = p.compute_persistent_betti_numbers();
- for (size_t i = 0; i != pbns.size(); ++i) {
- std::cout << pbns[i].first << " " << pbns[i].second << std::endl;
- }
-
- return 0;
-}
diff --git a/example/Persistence_representations/persistence_landscape.cpp b/example/Persistence_representations/persistence_landscape.cpp
deleted file mode 100644
index 27542cf7..00000000
--- a/example/Persistence_representations/persistence_landscape.cpp
+++ /dev/null
@@ -1,86 +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.
- *
- * Author(s): Pawel Dlotko
- *
- * Copyright (C) 2016 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/Persistence_landscape.h>
-
-#include <iostream>
-#include <vector>
-#include <utility>
-
-using Persistence_landscape = Gudhi::Persistence_representations::Persistence_landscape;
-
-int main(int argc, char** argv) {
- // create two simple vectors with birth--death pairs:
-
- std::vector<std::pair<double, double> > persistence1;
- std::vector<std::pair<double, double> > persistence2;
-
- persistence1.push_back(std::make_pair(1, 2));
- persistence1.push_back(std::make_pair(6, 8));
- persistence1.push_back(std::make_pair(0, 4));
- persistence1.push_back(std::make_pair(3, 8));
-
- persistence2.push_back(std::make_pair(2, 9));
- persistence2.push_back(std::make_pair(1, 6));
- persistence2.push_back(std::make_pair(3, 5));
- persistence2.push_back(std::make_pair(6, 10));
-
- // create two persistence landscapes based on persistence1 and persistence2:
- Persistence_landscape l1(persistence1);
- Persistence_landscape l2(persistence2);
-
- // This is how to compute integral of landscapes:
- std::cout << "Integral of the first landscape : " << l1.compute_integral_of_landscape() << std::endl;
- std::cout << "Integral of the second landscape : " << l2.compute_integral_of_landscape() << std::endl;
-
- // And here how to write landscapes to stream:
- std::cout << "l1 : " << l1 << std::endl;
- std::cout << "l2 : " << l2 << std::endl;
-
- // Arithmetic operations on landscapes:
- Persistence_landscape sum = l1 + l2;
- std::cout << "sum : " << sum << std::endl;
-
- // here are the maxima of the functions:
- std::cout << "Maximum of l1 : " << l1.compute_maximum() << std::endl;
- std::cout << "Maximum of l2 : " << l2.compute_maximum() << std::endl;
-
- // here are the norms of landscapes:
- std::cout << "L^1 Norm of l1 : " << l1.compute_norm_of_landscape(1.) << std::endl;
- std::cout << "L^1 Norm of l2 : " << l2.compute_norm_of_landscape(1.) << std::endl;
-
- // here is the average of landscapes:
- Persistence_landscape average;
- average.compute_average({&l1, &l2});
- std::cout << "average : " << average << std::endl;
-
- // here is the distance of landscapes:
- std::cout << "Distance : " << l1.distance(l2) << std::endl;
-
- // here is the scalar product of landscapes:
- std::cout << "Scalar product : " << l1.compute_scalar_product(l2) << std::endl;
-
- // here is how to create a file which is suitable for visualization via gnuplot:
- average.plot("average_landscape");
-
- return 0;
-}
diff --git a/example/Persistence_representations/persistence_landscape_on_grid.cpp b/example/Persistence_representations/persistence_landscape_on_grid.cpp
deleted file mode 100644
index 0f471a67..00000000
--- a/example/Persistence_representations/persistence_landscape_on_grid.cpp
+++ /dev/null
@@ -1,82 +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.
- *
- * Author(s): Pawel Dlotko
- *
- * Copyright (C) 2016 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/Persistence_landscape_on_grid.h>
-
-#include <iostream>
-#include <utility>
-#include <vector>
-
-using Persistence_landscape_on_grid = Gudhi::Persistence_representations::Persistence_landscape_on_grid;
-
-int main(int argc, char** argv) {
- // create two simple vectors with birth--death pairs:
-
- std::vector<std::pair<double, double> > persistence1;
- std::vector<std::pair<double, double> > persistence2;
-
- persistence1.push_back(std::make_pair(1, 2));
- persistence1.push_back(std::make_pair(6, 8));
- persistence1.push_back(std::make_pair(0, 4));
- persistence1.push_back(std::make_pair(3, 8));
-
- persistence2.push_back(std::make_pair(2, 9));
- persistence2.push_back(std::make_pair(1, 6));
- persistence2.push_back(std::make_pair(3, 5));
- persistence2.push_back(std::make_pair(6, 10));
-
- // create two persistence landscapes based on persistence1 and persistence2:
- Persistence_landscape_on_grid l1(persistence1, 0, 11, 20);
- Persistence_landscape_on_grid l2(persistence2, 0, 11, 20);
-
- // This is how to compute integral of landscapes:
- std::cout << "Integral of the first landscape : " << l1.compute_integral_of_landscape() << std::endl;
- std::cout << "Integral of the second landscape : " << l2.compute_integral_of_landscape() << std::endl;
-
- // And here how to write landscapes to stream:
- std::cout << "l1 : " << l1 << std::endl;
- std::cout << "l2 : " << l2 << std::endl;
-
- // here are the maxima of the functions:
- std::cout << "Maximum of l1 : " << l1.compute_maximum() << std::endl;
- std::cout << "Maximum of l2 : " << l2.compute_maximum() << std::endl;
-
- // here are the norms of landscapes:
- std::cout << "L^1 Norm of l1 : " << l1.compute_norm_of_landscape(1.) << std::endl;
- std::cout << "L^1 Norm of l2 : " << l2.compute_norm_of_landscape(1.) << std::endl;
-
- // here is the average of landscapes:
- Persistence_landscape_on_grid average;
- average.compute_average({&l1, &l2});
- std::cout << "average : " << average << std::endl;
-
- // here is the distance of landscapes:
- std::cout << "Distance : " << l1.distance(l2) << std::endl;
-
- // here is the scalar product of landscapes:
- std::cout << "Scalar product : " << l1.compute_scalar_product(l2) << std::endl;
-
- // here is how to create a file which is suitable for visualization via gnuplot:
- average.plot("average_landscape");
-
- return 0;
-}
diff --git a/example/Persistence_representations/persistence_vectors.cpp b/example/Persistence_representations/persistence_vectors.cpp
deleted file mode 100644
index 072e530d..00000000
--- a/example/Persistence_representations/persistence_vectors.cpp
+++ /dev/null
@@ -1,74 +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.
- *
- * Author(s): Pawel Dlotko
- *
- * Copyright (C) 2016 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/Persistence_vectors.h>
-
-#include <iostream>
-#include <vector>
-#include <cmath>
-#include <iomanip>
-#include <limits>
-#include <utility>
-
-using Vector_distances_in_diagram =
- Gudhi::Persistence_representations::Vector_distances_in_diagram<Gudhi::Euclidean_distance>;
-
-int main(int argc, char** argv) {
- // create two simple vectors with birth--death pairs:
-
- std::vector<std::pair<double, double> > persistence1;
- std::vector<std::pair<double, double> > persistence2;
-
- persistence1.push_back(std::make_pair(1, 2));
- persistence1.push_back(std::make_pair(6, 8));
- persistence1.push_back(std::make_pair(0, 4));
- persistence1.push_back(std::make_pair(3, 8));
-
- persistence2.push_back(std::make_pair(2, 9));
- persistence2.push_back(std::make_pair(1, 6));
- persistence2.push_back(std::make_pair(3, 5));
- persistence2.push_back(std::make_pair(6, 10));
-
- // create two persistence vectors based on persistence1 and persistence2:
- Vector_distances_in_diagram v1(persistence1, std::numeric_limits<size_t>::max());
- Vector_distances_in_diagram v2(persistence2, std::numeric_limits<size_t>::max());
-
- // writing to a stream:
- std::cout << "v1 : " << v1 << std::endl;
- std::cout << "v2 : " << v2 << std::endl;
-
- // averages:
- Vector_distances_in_diagram average;
- average.compute_average({&v1, &v2});
- std::cout << "Average : " << average << std::endl;
-
- // computations of distances:
- std::cout << "l^1 distance : " << v1.distance(v2) << std::endl;
-
- // computations of scalar product:
- std::cout << "Scalar product of l1 and l2 : " << v1.compute_scalar_product(v2) << std::endl;
-
- // create a file with a gnuplot script:
- v1.plot("plot_of_vector_representation");
-
- return 0;
-}
diff --git a/example/Persistent_cohomology/CMakeLists.txt b/example/Persistent_cohomology/CMakeLists.txt
deleted file mode 100644
index 0f731519..00000000
--- a/example/Persistent_cohomology/CMakeLists.txt
+++ /dev/null
@@ -1,69 +0,0 @@
-project(Persistent_cohomology_examples)
-
-add_executable(plain_homology plain_homology.cpp)
-
-add_executable(persistence_from_simple_simplex_tree persistence_from_simple_simplex_tree.cpp)
-
-add_executable(rips_persistence_step_by_step rips_persistence_step_by_step.cpp)
-target_link_libraries(rips_persistence_step_by_step ${Boost_PROGRAM_OPTIONS_LIBRARY})
-
-add_executable(rips_persistence_via_boundary_matrix rips_persistence_via_boundary_matrix.cpp)
-target_link_libraries(rips_persistence_via_boundary_matrix ${Boost_PROGRAM_OPTIONS_LIBRARY})
-
-add_executable(persistence_from_file persistence_from_file.cpp)
-target_link_libraries(persistence_from_file ${Boost_PROGRAM_OPTIONS_LIBRARY})
-
-if (TBB_FOUND)
- target_link_libraries(plain_homology ${TBB_LIBRARIES})
- target_link_libraries(persistence_from_simple_simplex_tree ${TBB_LIBRARIES})
- target_link_libraries(rips_persistence_step_by_step ${TBB_LIBRARIES})
- target_link_libraries(rips_persistence_via_boundary_matrix ${TBB_LIBRARIES})
- target_link_libraries(persistence_from_file ${TBB_LIBRARIES})
-endif()
-
-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_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")
-
-install(TARGETS plain_homology DESTINATION bin)
-install(TARGETS persistence_from_simple_simplex_tree DESTINATION bin)
-install(TARGETS rips_persistence_step_by_step DESTINATION bin)
-install(TARGETS rips_persistence_via_boundary_matrix DESTINATION bin)
-install(TARGETS persistence_from_file DESTINATION bin)
-
-if(GMP_FOUND)
- if(GMPXX_FOUND)
- add_executable(rips_multifield_persistence rips_multifield_persistence.cpp )
- target_link_libraries(rips_multifield_persistence
- ${Boost_PROGRAM_OPTIONS_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES})
- if (TBB_FOUND)
- target_link_libraries(rips_multifield_persistence ${TBB_LIBRARIES})
- endif(TBB_FOUND)
- 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")
- install(TARGETS rips_multifield_persistence DESTINATION bin)
- endif(GMPXX_FOUND)
-endif(GMP_FOUND)
-
-if(CGAL_FOUND)
- if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
- add_executable(custom_persistence_sort custom_persistence_sort.cpp)
- target_link_libraries(custom_persistence_sort ${CGAL_LIBRARY})
-
- if (TBB_FOUND)
- target_link_libraries(custom_persistence_sort ${TBB_LIBRARIES})
- endif(TBB_FOUND)
- add_test(NAME Persistent_cohomology_example_custom_persistence_sort COMMAND $<TARGET_FILE:custom_persistence_sort>)
-
- install(TARGETS custom_persistence_sort DESTINATION bin)
-
- endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
-endif(CGAL_FOUND)
diff --git a/example/Persistent_cohomology/README b/example/Persistent_cohomology/README
deleted file mode 100644
index f39d9584..00000000
--- a/example/Persistent_cohomology/README
+++ /dev/null
@@ -1,67 +0,0 @@
-To build the examples, run in a Terminal:
-
-cd /path-to-examples/
-cmake .
-make
-
-***********************************************************************************************************************
-Example of use of RIPS:
-
-Computation of the persistent homology with Z/2Z and Z/3Z coefficients simultaneously of the Rips complex
-on points sampling a 3D torus:
-
-./rips_multifield_persistence ../../data/points/tore3D_1307.off -r 0.25 -m 0.12 -d 3 -p 2 -q 3
-
-output:
-6 0 0 inf
-6 1 0.0983494 inf
-6 1 0.104347 inf
-6 2 0.138335 inf
-6 0 0 0.122545
-6 0 0 0.121171
-6 0 0 0.120964
-6 0 0 0.12057
-6 0 0 0.12047
-6 0 0 0.120414
-
-Every line is of this format: p1*...*pr dim b d
-where
- p1*...*pr is the product of prime numbers pi such that the homology feature exists in homology with Z/piZ coefficients.
- dim is the dimension of the homological feature,
- b and d are respectively the birth and death of the feature and
-
-and the computation with all Z/pZ for 2 <= p <= 71 (20 first prime numbers):
-
- ./rips_multifield_persistence ../../data/points/Kl.off -r 0.25 -m 0.5 -d 3 -p 2 -q 71
-
-output:
-557940830126698960967415390 0 0 inf
-557940830126698960967415390 1 0.0983494 inf
-557940830126698960967415390 1 0.104347 inf
-557940830126698960967415390 2 0.138335 inf
-557940830126698960967415390 0 0 0.122545
-557940830126698960967415390 0 0 0.121171
-557940830126698960967415390 0 0 0.120964
-557940830126698960967415390 0 0 0.12057
-557940830126698960967415390 0 0 0.12047
-557940830126698960967415390 0 0 0.120414
-
-***********************************************************************************************************************
-Example of use of PLAIN HOMOLOGY:
-
-This example computes the plain homology of the following simplicial complex without filtration values:
- /* Complex to build. */
- /* 1 3 */
- /* o---o */
- /* /X\ / */
- /* o---o o */
- /* 2 0 4 */
-
-./plain_homology
-
-output:
-2 0 0 inf
-2 0 0 inf
-2 1 0 inf
-
-Here we retrieve the 2 entities {0,1,2,3} and {4} (Betti numbers[0] = 2) and the hole in {0,1,3} (Betti numbers[1] = 1)
diff --git a/example/Persistent_cohomology/custom_persistence_sort.cpp b/example/Persistent_cohomology/custom_persistence_sort.cpp
deleted file mode 100644
index 35366144..00000000
--- a/example/Persistent_cohomology/custom_persistence_sort.cpp
+++ /dev/null
@@ -1,137 +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.
- *
- * Author(s): Vincent Rouvreau
- *
- * Copyright (C) 2014 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 <CGAL/Epick_d.h>
-#include <CGAL/point_generators_d.h>
-#include <CGAL/algorithm.h>
-#include <CGAL/assertions.h>
-
-#include <gudhi/Alpha_complex.h>
-#include <gudhi/Persistent_cohomology.h>
-// to construct a simplex_tree from alpha complex
-#include <gudhi/Simplex_tree.h>
-
-#include <iostream>
-#include <iterator>
-#include <vector>
-#include <fstream> // for std::ofstream
-#include <algorithm> // for std::sort
-
-
-using Kernel = CGAL::Epick_d< CGAL::Dimension_tag<3> >;
-using Point = Kernel::Point_d;
-using Alpha_complex = Gudhi::alpha_complex::Alpha_complex<Kernel>;
-using Simplex_tree = Gudhi::Simplex_tree<>;
-using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomology< Simplex_tree,
- Gudhi::persistent_cohomology::Field_Zp >;
-
-std::vector<Point> random_points() {
- // Instanciate a random point generator
- CGAL::Random rng(0);
-
- // Generate "points_number" random points in a vector
- std::vector<Point> points;
-
- // Generates 1000 random 3D points on a sphere of radius 4.0
- CGAL::Random_points_on_sphere_d<Point> rand_outside(3, 4.0, rng);
- CGAL::cpp11::copy_n(rand_outside, 1000, std::back_inserter(points));
- // Generates 2000 random 3D points in a sphere of radius 3.0
- CGAL::Random_points_in_ball_d<Point> rand_inside(3, 3.0, rng);
- CGAL::cpp11::copy_n(rand_inside, 2000, std::back_inserter(points));
-
- return points;
-}
-
-/*
- * Compare two intervals by dimension, then by length.
- */
-struct cmp_intervals_by_dim_then_length {
- explicit cmp_intervals_by_dim_then_length(Simplex_tree * sc)
- : sc_(sc) { }
-
- template<typename Persistent_interval>
- bool operator()(const Persistent_interval & p1, const Persistent_interval & p2) {
- if (sc_->dimension(get < 0 > (p1)) == sc_->dimension(get < 0 > (p2)))
- return (sc_->filtration(get < 1 > (p1)) - sc_->filtration(get < 0 > (p1))
- > sc_->filtration(get < 1 > (p2)) - sc_->filtration(get < 0 > (p2)));
- else
- return (sc_->dimension(get < 0 > (p1)) > sc_->dimension(get < 0 > (p2)));
- }
- Simplex_tree* sc_;
-};
-
-int main(int argc, char **argv) {
- std::vector<Point> points = random_points();
-
- std::cout << "Points size=" << points.size() << std::endl;
- // Alpha complex persistence computation from generated points
- Alpha_complex alpha_complex_from_points(points);
- std::cout << "alpha_complex_from_points" << std::endl;
-
- Simplex_tree simplex;
- std::cout << "simplex" << std::endl;
- if (alpha_complex_from_points.create_complex(simplex, 0.6)) {
- std::cout << "simplex" << std::endl;
- // ----------------------------------------------------------------------------
- // Display information about the alpha complex
- // ----------------------------------------------------------------------------
- std::cout << "Simplicial complex is of dimension " << simplex.dimension() <<
- " - " << simplex.num_simplices() << " simplices - " <<
- simplex.num_vertices() << " vertices." << std::endl;
-
- // Sort the simplices in the order of the filtration
- simplex.initialize_filtration();
-
- std::cout << "Simplex_tree dim: " << simplex.dimension() << std::endl;
-
- Persistent_cohomology pcoh(simplex);
-
- // initializes the coefficient field for homology - Z/3Z
- pcoh.init_coefficients(3);
- pcoh.compute_persistent_cohomology(0.2);
-
- // Custom sort and output persistence
- cmp_intervals_by_dim_then_length cmp(&simplex);
- auto persistent_pairs = pcoh.get_persistent_pairs();
- std::sort(std::begin(persistent_pairs), std::end(persistent_pairs), cmp);
- for (auto pair : persistent_pairs) {
- std::cout << simplex.dimension(get<0>(pair)) << " "
- << simplex.filtration(get<0>(pair)) << " "
- << simplex.filtration(get<1>(pair)) << std::endl;
- }
-
- // Persistent Betti numbers
- std::cout << "The persistent Betti numbers in interval [0.40, 0.41] are : ";
- for (int dim = 0; dim < simplex.dimension(); dim++)
- std::cout << "b" << dim << " = " << pcoh.persistent_betti_number(dim, 0.40, 0.41) << " ; ";
- std::cout << std::endl;
-
- // Betti numbers
- std::vector<int> betti_numbers = pcoh.betti_numbers();
- std::cout << "The Betti numbers are : ";
- for (std::size_t i = 0; i < betti_numbers.size(); i++)
- std::cout << "b" << i << " = " << betti_numbers[i] << " ; ";
- std::cout << std::endl;
- }
- return 0;
-}
-
diff --git a/example/Persistent_cohomology/persistence_from_file.cpp b/example/Persistent_cohomology/persistence_from_file.cpp
deleted file mode 100644
index 53456919..00000000
--- a/example/Persistent_cohomology/persistence_from_file.cpp
+++ /dev/null
@@ -1,143 +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.
- *
- * Author(s): Vincent Rouvreau
- *
- * Copyright (C) 2014 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/reader_utils.h>
-#include <gudhi/graph_simplicial_complex.h>
-#include <gudhi/distance_functions.h>
-#include <gudhi/Simplex_tree.h>
-#include <gudhi/Persistent_cohomology.h>
-
-#include <boost/program_options.hpp>
-
-#include <string>
-
-using namespace Gudhi;
-using namespace Gudhi::persistent_cohomology;
-
-typedef int Vertex_handle;
-typedef double Filtration_value;
-
-void program_options(int argc, char * argv[]
- , std::string & simplex_tree_file
- , std::string & output_file
- , int & p
- , Filtration_value & min_persistence);
-
-int main(int argc, char * argv[]) {
- std::string simplex_tree_file;
- std::string output_file;
- int p;
- Filtration_value min_persistence;
-
- program_options(argc, argv, simplex_tree_file, output_file, p, min_persistence);
-
- std::cout << "Simplex_tree from file=" << simplex_tree_file.c_str() << " - output_file=" << output_file.c_str()
- << std::endl;
- std::cout << " - p=" << p << " - min_persistence=" << min_persistence << std::endl;
-
- // Read the list of simplices from a file.
- Simplex_tree<> simplex_tree;
-
- std::ifstream simplex_tree_stream(simplex_tree_file);
- simplex_tree_stream >> simplex_tree;
-
- std::cout << "The complex contains " << simplex_tree.num_simplices() << " simplices" << std::endl;
- std::cout << " - dimension " << simplex_tree.dimension() << std::endl;
-
- /*
- std::cout << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl;
- for( auto f_simplex : simplex_tree.filtration_simplex_range() )
- { std::cout << " " << "[" << simplex_tree.filtration(f_simplex) << "] ";
- for( auto vertex : simplex_tree.simplex_vertex_range(f_simplex) )
- { std::cout << vertex << " "; }
- std::cout << std::endl;
- }*/
-
- // Sort the simplices in the order of the filtration
- simplex_tree.initialize_filtration();
-
- // Compute the persistence diagram of the complex
- Persistent_cohomology< Simplex_tree<>, Field_Zp > pcoh(simplex_tree);
- // initializes the coefficient field for homology
- pcoh.init_coefficients(p);
-
- pcoh.compute_persistent_cohomology(min_persistence);
-
- // Output the diagram in output_file
- if (output_file.empty()) {
- pcoh.output_diagram();
- } else {
- std::ofstream out(output_file);
- pcoh.output_diagram(out);
- out.close();
- }
-
- return 0;
-}
-
-void program_options(int argc, char * argv[]
- , std::string & simplex_tree_file
- , std::string & output_file
- , int & p
- , Filtration_value & min_persistence) {
- namespace po = boost::program_options;
- po::options_description hidden("Hidden options");
- hidden.add_options()
- ("input-file", po::value<std::string>(&simplex_tree_file),
- "Name of file containing a simplex set. Format is one simplex per line (cf. reader_utils.h - read_simplex): Dim1 X11 X12 ... X1d Fil1 ");
-
- po::options_description visible("Allowed options", 100);
- visible.add_options()
- ("help,h", "produce help message")
- ("output-file,o", po::value<std::string>(&output_file)->default_value(std::string()),
- "Name of file in which the persistence diagram is written. Default print in std::cout")
- ("field-charac,p", po::value<int>(&p)->default_value(11),
- "Characteristic p of the coefficient field Z/pZ for computing homology.")
- ("min-persistence,m", po::value<Filtration_value>(&min_persistence),
- "Minimal lifetime of homology feature to be recorded. Default is 0");
-
- po::positional_options_description pos;
- pos.add("input-file", 1);
-
- po::options_description all;
- all.add(visible).add(hidden);
-
- po::variables_map vm;
- po::store(po::command_line_parser(argc, argv).
- options(all).positional(pos).run(), vm);
- po::notify(vm);
-
- if (vm.count("help") || !vm.count("input-file")) {
- std::cout << std::endl;
- std::cout << "Compute the persistent homology with coefficient field Z/pZ \n";
- std::cout << "of a Rips complex defined on a set of input points.\n \n";
- std::cout << "The output diagram contains one bar per line, written with the convention: \n";
- std::cout << " p dim b d \n";
- std::cout << "where dim is the dimension of the homological feature,\n";
- std::cout << "b and d are respectively the birth and death of the feature and \n";
- std::cout << "p is the characteristic of the field Z/pZ used for homology coefficients." << std::endl << std::endl;
-
- std::cout << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl;
- std::cout << visible << std::endl;
- exit(-1);
- }
-}
diff --git a/example/Persistent_cohomology/persistence_from_simple_simplex_tree.cpp b/example/Persistent_cohomology/persistence_from_simple_simplex_tree.cpp
deleted file mode 100644
index ffccfd86..00000000
--- a/example/Persistent_cohomology/persistence_from_simple_simplex_tree.cpp
+++ /dev/null
@@ -1,175 +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.
- *
- * Author(s): Vincent Rouvreau
- *
- * Copyright (C) 2014 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/graph_simplicial_complex.h>
-#include <gudhi/Simplex_tree.h>
-#include <gudhi/Persistent_cohomology.h>
-
-#include <iostream>
-#include <ctime>
-#include <utility>
-#include <vector>
-
-// Types definition
-using Simplex_tree = Gudhi::Simplex_tree<>;
-using Filtration_value = Simplex_tree::Filtration_value;
-using Field_Zp = Gudhi::persistent_cohomology::Field_Zp;
-using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomology<Simplex_tree, Field_Zp >;
-using typeVectorVertex = std::vector< Simplex_tree::Vertex_handle >;
-
-void usage(char * const progName) {
- std::cerr << "Usage: " << progName << " coeff_field_characteristic[integer > 0] min_persistence[float >= -1.0]\n";
- exit(-1);
-}
-
-int main(int argc, char * const argv[]) {
- // program args management
- if (argc != 3) {
- std::cerr << "Error: Number of arguments (" << argc << ") is not correct\n";
- usage(argv[0]);
- }
-
- int coeff_field_characteristic = 0;
- int returnedScanValue = sscanf(argv[1], "%d", &coeff_field_characteristic);
- if ((returnedScanValue == EOF) || (coeff_field_characteristic <= 0)) {
- std::cerr << "Error: " << argv[1] << " is not correct\n";
- usage(argv[0]);
- }
-
- Filtration_value min_persistence = 0.0;
- returnedScanValue = sscanf(argv[2], "%lf", &min_persistence);
- if ((returnedScanValue == EOF) || (min_persistence < -1.0)) {
- std::cerr << "Error: " << argv[2] << " is not correct\n";
- usage(argv[0]);
- }
-
- // TEST OF INSERTION
- std::cout << "********************************************************************" << std::endl;
- std::cout << "TEST OF INSERTION" << std::endl;
- Simplex_tree st;
-
- // ++ FIRST
- std::cout << " - INSERT (0,1,2)" << std::endl;
- typeVectorVertex SimplexVector = {0, 1, 2};
- st.insert_simplex_and_subfaces(SimplexVector, 0.3);
-
- // ++ SECOND
- std::cout << " - INSERT 3" << std::endl;
- SimplexVector = {3};
- st.insert_simplex_and_subfaces(SimplexVector, 0.1);
-
- // ++ THIRD
- std::cout << " - INSERT (0,3)" << std::endl;
- SimplexVector = {0, 3};
- st.insert_simplex_and_subfaces(SimplexVector, 0.2);
-
- // ++ FOURTH
- std::cout << " - INSERT (0,1) (already inserted)" << std::endl;
- SimplexVector = {0, 1};
- st.insert_simplex_and_subfaces(SimplexVector, 0.2);
-
- // ++ FIFTH
- std::cout << " - INSERT (3,4,5)" << std::endl;
- SimplexVector = {3, 4, 5};
- st.insert_simplex_and_subfaces(SimplexVector, 0.3);
-
- // ++ SIXTH
- std::cout << " - INSERT (0,1,6,7)" << std::endl;
- SimplexVector = {0, 1, 6, 7};
- st.insert_simplex_and_subfaces(SimplexVector, 0.4);
-
- // ++ SEVENTH
- std::cout << " - INSERT (4,5,8,9)" << std::endl;
- SimplexVector = {4, 5, 8, 9};
- st.insert_simplex_and_subfaces(SimplexVector, 0.4);
-
- // ++ EIGHTH
- std::cout << " - INSERT (9,10,11)" << std::endl;
- SimplexVector = {9, 10, 11};
- st.insert_simplex_and_subfaces(SimplexVector, 0.3);
-
- // ++ NINETH
- std::cout << " - INSERT (2,10,12)" << std::endl;
- SimplexVector = {2, 10, 12};
- st.insert_simplex_and_subfaces(SimplexVector, 0.3);
-
- // ++ TENTH
- std::cout << " - INSERT (11,6)" << std::endl;
- SimplexVector = {6, 11};
- st.insert_simplex_and_subfaces(SimplexVector, 0.2);
-
- // ++ ELEVENTH
- std::cout << " - INSERT (13,14,15)" << std::endl;
- SimplexVector = {13, 14, 15};
- st.insert_simplex_and_subfaces(SimplexVector, 0.25);
-
- /* Inserted simplex: */
- /* 1 6 */
- /* o---o */
- /* /X\7/ 4 2 */
- /* o---o---o---o o */
- /* 2 0 3\X/8\ 10 /X\ */
- /* o---o---o---o */
- /* 5 9\X/ 12 */
- /* o---o */
- /* 11 6 */
- /* In other words: */
- /* A facet [2,1,0] */
- /* An edge [0,3] */
- /* A facet [3,4,5] */
- /* A cell [0,1,6,7] */
- /* A cell [4,5,8,9] */
- /* A facet [9,10,11] */
- /* An edge [11,6] */
- /* An edge [10,12,2] */
-
-
- std::cout << "The complex contains " << st.num_simplices() << " simplices - " << st.num_vertices() << " vertices "
- << std::endl;
- std::cout << " - dimension " << st.dimension() << std::endl;
- std::cout << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:"
- << std::endl;
- std::cout << "**************************************************************" << std::endl;
- std::cout << "strict graph G { " << std::endl;
-
- for (auto f_simplex : st.filtration_simplex_range()) {
- std::cout << " " << "[" << st.filtration(f_simplex) << "] ";
- for (auto vertex : st.simplex_vertex_range(f_simplex)) {
- std::cout << static_cast<int>(vertex) << " -- ";
- }
- std::cout << ";" << std::endl;
- }
-
- std::cout << "}" << std::endl;
- std::cout << "**************************************************************" << std::endl;
-
- // Compute the persistence diagram of the complex
- Persistent_cohomology pcoh(st);
- // initializes the coefficient field for homology
- pcoh.init_coefficients(coeff_field_characteristic);
-
- pcoh.compute_persistent_cohomology(min_persistence);
-
- // Output the diagram in filediag
- pcoh.output_diagram();
- return 0;
-}
diff --git a/example/Persistent_cohomology/plain_homology.cpp b/example/Persistent_cohomology/plain_homology.cpp
deleted file mode 100644
index a2256060..00000000
--- a/example/Persistent_cohomology/plain_homology.cpp
+++ /dev/null
@@ -1,94 +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.
- *
- * Author(s): Marc Glisse
- *
- * 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/Simplex_tree.h>
-#include <gudhi/Persistent_cohomology.h>
-
-#include <iostream>
-#include <vector>
-#include <cstdint> // for std::uint8_t
-
-/* We could perfectly well use the default Simplex_tree<> (which uses
- * Simplex_tree_options_full_featured), the following simply demonstrates
- * how to save on storage by not storing a filtration value. */
-
-struct MyOptions : Gudhi::Simplex_tree_options_full_featured {
- // Implicitly use 0 as filtration value for all simplices
- static const bool store_filtration = false;
- // The persistence algorithm needs this
- static const bool store_key = true;
- // I have few vertices
- typedef short Vertex_handle;
- // Maximum number of simplices to compute persistence is 2^8 - 1 = 255. One is reserved for null_key
- typedef std::uint8_t Simplex_key;
-};
-
-using ST = Gudhi::Simplex_tree<MyOptions>;
-using Field_Zp = Gudhi::persistent_cohomology::Field_Zp;
-using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomology<ST, Field_Zp>;
-
-int main() {
- ST st;
-
- /* Complex to build. */
- /* 1 3 */
- /* o---o */
- /* /X\ / */
- /* o---o o */
- /* 2 0 4 */
-
- const short triangle012[] = {0, 1, 2};
- const short edge03[] = {0, 3};
- const short edge13[] = {1, 3};
- const short vertex4[] = {4};
- st.insert_simplex_and_subfaces(triangle012);
- st.insert_simplex_and_subfaces(edge03);
- st.insert_simplex(edge13);
- st.insert_simplex(vertex4);
-
- // Sort the simplices in the order of the filtration
- st.initialize_filtration();
-
- // Class for homology computation
- Persistent_cohomology pcoh(st);
-
- // Initialize the coefficient field Z/2Z for homology
- pcoh.init_coefficients(2);
-
- // Compute the persistence diagram of the complex
- pcoh.compute_persistent_cohomology();
-
- // Print the result. The format is, on each line: 2 dim 0 inf
- // where 2 represents the field, dim the dimension of the feature.
- // 2 0 0 inf
- // 2 0 0 inf
- // 2 1 0 inf
- // means that in Z/2Z-homology, the Betti numbers are b0=2 and b1=1.
- pcoh.output_diagram();
-
- // Print the Betti numbers are b0=2 and b1=1.
- std::cout << std::endl;
- std::cout << "The Betti numbers are : ";
- for (int i = 0; i < st.dimension(); i++)
- std::cout << "b" << i << " = " << pcoh.betti_number(i) << " ; ";
- std::cout << std::endl;
-}
diff --git a/example/Persistent_cohomology/rips_multifield_persistence.cpp b/example/Persistent_cohomology/rips_multifield_persistence.cpp
deleted file mode 100644
index d6a5bdad..00000000
--- a/example/Persistent_cohomology/rips_multifield_persistence.cpp
+++ /dev/null
@@ -1,154 +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.
- *
- * Author(s): Clément Maria
- *
- * Copyright (C) 2014 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/Rips_complex.h>
-#include <gudhi/distance_functions.h>
-#include <gudhi/Simplex_tree.h>
-#include <gudhi/Persistent_cohomology.h>
-#include <gudhi/Persistent_cohomology/Multi_field.h>
-#include <gudhi/Points_off_io.h>
-
-#include <boost/program_options.hpp>
-
-#include <string>
-#include <vector>
-
-// Types definition
-using Simplex_tree = Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_fast_persistence>;
-using Filtration_value = Simplex_tree::Filtration_value;
-using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
-using Multi_field = Gudhi::persistent_cohomology::Multi_field;
-using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomology<Simplex_tree, Multi_field >;
-using Point = std::vector<double>;
-using Points_off_reader = Gudhi::Points_off_reader<Point>;
-
-void program_options(int argc, char * argv[]
- , std::string & off_file_points
- , std::string & filediag
- , Filtration_value & threshold
- , int & dim_max
- , int & min_p
- , int & max_p
- , Filtration_value & min_persistence);
-
-int main(int argc, char * argv[]) {
- std::string off_file_points;
- std::string filediag;
- Filtration_value threshold;
- int dim_max;
- int min_p;
- int max_p;
- Filtration_value min_persistence;
-
- 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, Gudhi::Euclidean_distance());
-
- // Construct the Rips complex in a Simplex Tree
- Simplex_tree simplex_tree;
-
- rips_complex_from_file.create_complex(simplex_tree, dim_max);
- std::cout << "The complex contains " << simplex_tree.num_simplices() << " simplices \n";
- std::cout << " and has dimension " << simplex_tree.dimension() << " \n";
-
- // Sort the simplices in the order of the filtration
- simplex_tree.initialize_filtration();
-
- // Compute the persistence diagram of the complex
- Persistent_cohomology pcoh(simplex_tree);
- // initializes the coefficient field for homology
- pcoh.init_coefficients(min_p, max_p);
-
- pcoh.compute_persistent_cohomology(min_persistence);
-
- // Output the diagram in filediag
- if (filediag.empty()) {
- pcoh.output_diagram();
- } else {
- std::ofstream out(filediag);
- pcoh.output_diagram(out);
- out.close();
- }
-
- return 0;
-}
-
-void program_options(int argc, char * argv[]
- , std::string & off_file_points
- , std::string & filediag
- , Filtration_value & threshold
- , int & dim_max
- , int & min_p
- , int & max_p
- , Filtration_value & min_persistence) {
- namespace po = boost::program_options;
- po::options_description hidden("Hidden options");
- hidden.add_options()
- ("input-file", po::value<std::string>(&off_file_points),
- "Name of an OFF file containing a point set.\n");
-
- po::options_description visible("Allowed options");
- visible.add_options()
- ("help,h", "produce help message")
- ("output-file,o", po::value<std::string>(&filediag)->default_value(std::string()),
- "Name of file in which the persistence diagram is written. Default print in std::cout")
- ("max-edge-length,r", po::value<Filtration_value>(&threshold)->default_value(0),
- "Maximal length of an edge for the Rips complex construction.")
- ("cpx-dimension,d", po::value<int>(&dim_max)->default_value(1),
- "Maximal dimension of the Rips complex we want to compute.")
- ("min-field-charac,p", po::value<int>(&min_p)->default_value(2),
- "Minimal characteristic p of the coefficient field Z/pZ.")
- ("max-field-charac,q", po::value<int>(&max_p)->default_value(1223),
- "Minimial characteristic q of the coefficient field Z/pZ.")
- ("min-persistence,m", po::value<Filtration_value>(&min_persistence),
- "Minimal lifetime of homology feature to be recorded. Default is 0");
-
- po::positional_options_description pos;
- pos.add("input-file", 1);
-
- po::options_description all;
- all.add(visible).add(hidden);
-
- po::variables_map vm;
- po::store(po::command_line_parser(argc, argv).
- options(all).positional(pos).run(), vm);
- po::notify(vm);
-
- if (vm.count("help") || !vm.count("input-file")) {
- std::cout << std::endl;
- std::cout << "Compute the persistent homology with various coefficient fields \n";
- std::cout << "of a Rips complex defined on a set of input points. The coefficient \n";
- std::cout << "fields are all the Z/rZ for a prime number r contained in the \n";
- std::cout << "specified range [p,q]\n \n";
- std::cout << "The output diagram contains one bar per line, written with the convention: \n";
- std::cout << " p1*...*pr dim b d \n";
- std::cout << "where dim is the dimension of the homological feature,\n";
- std::cout << "b and d are respectively the birth and death of the feature and \n";
- std::cout << "p1*...*pr is the product of prime numbers pi such that the homology \n";
- std::cout << "feature exists in homology with Z/piZ coefficients." << std::endl << std::endl;
-
- std::cout << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl;
- std::cout << visible << std::endl;
- exit(-1);
- }
-}
diff --git a/example/Persistent_cohomology/rips_persistence_step_by_step.cpp b/example/Persistent_cohomology/rips_persistence_step_by_step.cpp
deleted file mode 100644
index 796cfa3a..00000000
--- a/example/Persistent_cohomology/rips_persistence_step_by_step.cpp
+++ /dev/null
@@ -1,166 +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.
- *
- * Author(s): Clément Maria
- *
- * Copyright (C) 2014 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/graph_simplicial_complex.h>
-#include <gudhi/distance_functions.h>
-#include <gudhi/Simplex_tree.h>
-#include <gudhi/Persistent_cohomology.h>
-#include <gudhi/Points_off_io.h>
-
-#include <boost/program_options.hpp>
-
-#include <string>
-#include <vector>
-#include <limits> // infinity
-#include <utility> // for pair
-#include <map>
-
-// ----------------------------------------------------------------------------
-// rips_persistence_step_by_step is an example of each step that is required to
-// build a Rips over a Simplex_tree. Please refer to rips_persistence to see
-// how to do the same thing with the Rips_complex wrapper for less detailed
-// steps.
-// ----------------------------------------------------------------------------
-
-// Types definition
-using Simplex_tree = Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_fast_persistence>;
-using Vertex_handle = Simplex_tree::Vertex_handle;
-using Filtration_value = Simplex_tree::Filtration_value;
-using Proximity_graph = Gudhi::Proximity_graph<Simplex_tree>;
-
-using Field_Zp = Gudhi::persistent_cohomology::Field_Zp;
-using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomology<Simplex_tree, Field_Zp >;
-using Point = std::vector<double>;
-using Points_off_reader = Gudhi::Points_off_reader<Point>;
-
-void program_options(int argc, char * argv[]
- , std::string & off_file_points
- , std::string & filediag
- , Filtration_value & threshold
- , int & dim_max
- , int & p
- , Filtration_value & min_persistence);
-
-int main(int argc, char * argv[]) {
- std::string off_file_points;
- std::string filediag;
- Filtration_value threshold;
- int dim_max;
- int p;
- Filtration_value min_persistence;
-
- program_options(argc, argv, off_file_points, filediag, threshold, dim_max, p, min_persistence);
-
- // Extract the points from the file filepoints
- Points_off_reader off_reader(off_file_points);
-
- // Compute the proximity graph of the points
- Proximity_graph prox_graph = Gudhi::compute_proximity_graph<Simplex_tree>(off_reader.get_point_cloud(),
- threshold,
- Gudhi::Euclidean_distance());
-
- // Construct the Rips complex in a Simplex Tree
- Simplex_tree st;
- // insert the proximity graph in the simplex tree
- st.insert_graph(prox_graph);
- // expand the graph until dimension dim_max
- st.expansion(dim_max);
-
- std::cout << "The complex contains " << st.num_simplices() << " simplices \n";
- std::cout << " and has dimension " << st.dimension() << " \n";
-
- // Sort the simplices in the order of the filtration
- st.initialize_filtration();
-
- // Compute the persistence diagram of the complex
- Persistent_cohomology pcoh(st);
- // initializes the coefficient field for homology
- pcoh.init_coefficients(p);
-
- pcoh.compute_persistent_cohomology(min_persistence);
-
- // Output the diagram in filediag
- if (filediag.empty()) {
- pcoh.output_diagram();
- } else {
- std::ofstream out(filediag);
- pcoh.output_diagram(out);
- out.close();
- }
-
- return 0;
-}
-
-void program_options(int argc, char * argv[]
- , std::string & off_file_points
- , std::string & filediag
- , Filtration_value & threshold
- , int & dim_max
- , int & p
- , Filtration_value & min_persistence) {
- namespace po = boost::program_options;
- po::options_description hidden("Hidden options");
- hidden.add_options()
- ("input-file", po::value<std::string>(&off_file_points),
- "Name of an OFF file containing a point set.\n");
-
- po::options_description visible("Allowed options", 100);
- visible.add_options()
- ("help,h", "produce help message")
- ("output-file,o", po::value<std::string>(&filediag)->default_value(std::string()),
- "Name of file in which the persistence diagram is written. Default print in std::cout")
- ("max-edge-length,r",
- po::value<Filtration_value>(&threshold)->default_value(std::numeric_limits<Filtration_value>::infinity()),
- "Maximal length of an edge for the Rips complex construction.")
- ("cpx-dimension,d", po::value<int>(&dim_max)->default_value(1),
- "Maximal dimension of the Rips complex we want to compute.")
- ("field-charac,p", po::value<int>(&p)->default_value(11),
- "Characteristic p of the coefficient field Z/pZ for computing homology.")
- ("min-persistence,m", po::value<Filtration_value>(&min_persistence),
- "Minimal lifetime of homology feature to be recorded. Default is 0. Enter a negative value to see zero length intervals");
-
- po::positional_options_description pos;
- pos.add("input-file", 1);
-
- po::options_description all;
- all.add(visible).add(hidden);
-
- po::variables_map vm;
- po::store(po::command_line_parser(argc, argv).
- options(all).positional(pos).run(), vm);
- po::notify(vm);
-
- if (vm.count("help") || !vm.count("input-file")) {
- std::cout << std::endl;
- std::cout << "Compute the persistent homology with coefficient field Z/pZ \n";
- std::cout << "of a Rips complex defined on a set of input points.\n \n";
- std::cout << "The output diagram contains one bar per line, written with the convention: \n";
- std::cout << " p dim b d \n";
- std::cout << "where dim is the dimension of the homological feature,\n";
- std::cout << "b and d are respectively the birth and death of the feature and \n";
- std::cout << "p is the characteristic of the field Z/pZ used for homology coefficients." << std::endl << std::endl;
-
- std::cout << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl;
- std::cout << visible << std::endl;
- exit(-1);
- }
-}
diff --git a/example/Persistent_cohomology/rips_persistence_via_boundary_matrix.cpp b/example/Persistent_cohomology/rips_persistence_via_boundary_matrix.cpp
deleted file mode 100644
index 71fc0802..00000000
--- a/example/Persistent_cohomology/rips_persistence_via_boundary_matrix.cpp
+++ /dev/null
@@ -1,172 +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.
- *
- * Author(s): Clément Maria, Marc Glisse
- *
- * Copyright (C) 2014 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/Simplex_tree.h>
-#include <gudhi/Persistent_cohomology.h>
-#include <gudhi/Rips_complex.h>
-#include <gudhi/Hasse_complex.h>
-#include <gudhi/Points_off_io.h>
-#include <gudhi/distance_functions.h>
-
-#include <boost/program_options.hpp>
-
-#ifdef GUDHI_USE_TBB
-#include <tbb/task_scheduler_init.h>
-#endif
-
-#include <string>
-#include <vector>
-
-////////////////////////////////////////////////////////////////
-// //
-// WARNING: persistence computation itself is not parallel, //
-// and this uses more memory than rips_persistence. //
-// //
-////////////////////////////////////////////////////////////////
-
-// Types definition
-using Simplex_tree = Gudhi::Simplex_tree<>;
-using Filtration_value = Simplex_tree::Filtration_value;
-using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
-using Field_Zp = Gudhi::persistent_cohomology::Field_Zp;
-using Point = std::vector<double>;
-using Points_off_reader = Gudhi::Points_off_reader<Point>;
-
-void program_options(int argc, char * argv[]
- , std::string & off_file_points
- , std::string & filediag
- , Filtration_value & threshold
- , int & dim_max
- , int & p
- , Filtration_value & min_persistence);
-
-int main(int argc, char * argv[]) {
- std::string off_file_points;
- std::string filediag;
- Filtration_value threshold;
- int dim_max;
- int p;
- Filtration_value min_persistence;
-
- 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, Gudhi::Euclidean_distance());
-
- // Construct the Rips complex in a Simplex Tree
- Simplex_tree& st = *new Simplex_tree;
- rips_complex_from_file.create_complex(st, dim_max);
-
- std::cout << "The complex contains " << st.num_simplices() << " simplices \n";
- std::cout << " and has dimension " << st.dimension() << " \n";
-
-#ifdef GUDHI_USE_TBB
- // Unnecessary, but clarifies which operations are parallel.
- tbb::task_scheduler_init ts;
-#endif
-
- // Sort the simplices in the order of the filtration
- st.initialize_filtration();
- int count = 0;
- for (auto sh : st.filtration_simplex_range())
- st.assign_key(sh, count++);
-
- // Convert to a more convenient representation.
- Gudhi::Hasse_complex<> hcpx(st);
-
-#ifdef GUDHI_USE_TBB
- ts.terminate();
-#endif
-
- // Free some space.
- delete &st;
-
- // Compute the persistence diagram of the complex
- Gudhi::persistent_cohomology::Persistent_cohomology< Gudhi::Hasse_complex<>, Field_Zp > pcoh(hcpx);
- // initializes the coefficient field for homology
- pcoh.init_coefficients(p);
-
- pcoh.compute_persistent_cohomology(min_persistence);
-
- // Output the diagram in filediag
- if (filediag.empty()) {
- pcoh.output_diagram();
- } else {
- std::ofstream out(filediag);
- pcoh.output_diagram(out);
- out.close();
- }
-}
-
-void program_options(int argc, char * argv[]
- , std::string & off_file_points
- , std::string & filediag
- , Filtration_value & threshold
- , int & dim_max
- , int & p
- , Filtration_value & min_persistence) {
- namespace po = boost::program_options;
- po::options_description hidden("Hidden options");
- hidden.add_options()
- ("input-file", po::value<std::string>(&off_file_points),
- "Name of file containing a point set. Format is one point per line: X1 ... Xd ");
-
- po::options_description visible("Allowed options", 100);
- visible.add_options()
- ("help,h", "produce help message")
- ("output-file,o", po::value<std::string>(&filediag)->default_value(std::string()),
- "Name of file in which the persistence diagram is written. Default print in std::cout")
- ("max-edge-length,r", po::value<Filtration_value>(&threshold)->default_value(0),
- "Maximal length of an edge for the Rips complex construction.")
- ("cpx-dimension,d", po::value<int>(&dim_max)->default_value(1),
- "Maximal dimension of the Rips complex we want to compute.")
- ("field-charac,p", po::value<int>(&p)->default_value(11),
- "Characteristic p of the coefficient field Z/pZ for computing homology.")
- ("min-persistence,m", po::value<Filtration_value>(&min_persistence),
- "Minimal lifetime of homology feature to be recorded. Default is 0. Enter a negative value to see zero length intervals");
-
- po::positional_options_description pos;
- pos.add("input-file", 1);
-
- po::options_description all;
- all.add(visible).add(hidden);
-
- po::variables_map vm;
- po::store(po::command_line_parser(argc, argv).
- options(all).positional(pos).run(), vm);
- po::notify(vm);
-
- if (vm.count("help") || !vm.count("input-file")) {
- std::cout << std::endl;
- std::cout << "Compute the persistent homology with coefficient field Z/pZ \n";
- std::cout << "of a Rips complex defined on a set of input points.\n \n";
- std::cout << "The output diagram contains one bar per line, written with the convention: \n";
- std::cout << " p dim b d \n";
- std::cout << "where dim is the dimension of the homological feature,\n";
- std::cout << "b and d are respectively the birth and death of the feature and \n";
- std::cout << "p is the characteristic of the field Z/pZ used for homology coefficients." << std::endl << std::endl;
-
- std::cout << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl;
- std::cout << visible << std::endl;
- exit(-1);
- }
-}
diff --git a/example/Rips_complex/CMakeLists.txt b/example/Rips_complex/CMakeLists.txt
deleted file mode 100644
index e7772bdb..00000000
--- a/example/Rips_complex/CMakeLists.txt
+++ /dev/null
@@ -1,71 +0,0 @@
-project(Rips_complex_examples)
-
-# Point cloud
-add_executable ( Rips_complex_example_from_off example_rips_complex_from_off_file.cpp )
-
-add_executable ( Rips_complex_example_one_skeleton_from_points example_one_skeleton_rips_from_points.cpp )
-
-# Distance matrix
-add_executable ( Rips_complex_example_one_skeleton_from_distance_matrix example_one_skeleton_rips_from_distance_matrix.cpp )
-
-add_executable ( Rips_complex_example_from_csv_distance_matrix example_rips_complex_from_csv_distance_matrix_file.cpp )
-
-# Sparse rips from points
-add_executable ( Rips_complex_example_sparse example_sparse_rips.cpp )
-
-# Correlation matrix
-add_executable ( Rips_complex_example_one_skeleton_rips_from_correlation_matrix example_one_skeleton_rips_from_correlation_matrix.cpp )
-
-if (TBB_FOUND)
- 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})
- target_link_libraries(Rips_complex_example_sparse ${TBB_LIBRARIES})
- target_link_libraries(Rips_complex_example_one_skeleton_rips_from_correlation_matrix ${TBB_LIBRARIES})
-endif()
-
-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>)
-add_test(NAME Rips_complex_example_sparse
- COMMAND $<TARGET_FILE:Rips_complex_example_sparse>)
-add_test(NAME Rips_complex_example_one_skeleton_rips_from_correlation_matrix
- COMMAND $<TARGET_FILE:Rips_complex_example_one_skeleton_rips_from_correlation_matrix>)
-
-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")
-
-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)
- # Do not forget to copy test results files in current binary dir
- 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(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()
-
-install(TARGETS Rips_complex_example_from_off DESTINATION bin)
-install(TARGETS Rips_complex_example_one_skeleton_from_points DESTINATION bin)
-install(TARGETS Rips_complex_example_one_skeleton_from_distance_matrix DESTINATION bin)
-install(TARGETS Rips_complex_example_from_csv_distance_matrix DESTINATION bin)
-install(TARGETS Rips_complex_example_one_skeleton_rips_from_correlation_matrix DESTINATION bin)
diff --git a/example/Rips_complex/example_one_skeleton_rips_from_correlation_matrix.cpp b/example/Rips_complex/example_one_skeleton_rips_from_correlation_matrix.cpp
deleted file mode 100644
index 05bacb9f..00000000
--- a/example/Rips_complex/example_one_skeleton_rips_from_correlation_matrix.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-#include <gudhi/Rips_complex.h>
-#include <gudhi/Simplex_tree.h>
-#include <gudhi/distance_functions.h>
-
-#include <iostream>
-#include <string>
-#include <vector>
-#include <limits> // for std::numeric_limits
-
-int main() {
- // Type definitions
- using Simplex_tree = Gudhi::Simplex_tree<>;
- using Filtration_value = Simplex_tree::Filtration_value;
- using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
- using Distance_matrix = std::vector<std::vector<Filtration_value>>;
-
- // User defined correlation matrix is:
- // |1 0.06 0.23 0.01 0.89|
- // |0.06 1 0.74 0.01 0.61|
- // |0.23 0.74 1 0.72 0.03|
- // |0.01 0.01 0.72 1 0.7 |
- // |0.89 0.61 0.03 0.7 1 |
-
- Distance_matrix correlations;
- correlations.push_back({});
- correlations.push_back({0.06});
- correlations.push_back({0.23, 0.74});
- correlations.push_back({0.01, 0.01, 0.72});
- correlations.push_back({0.89, 0.61, 0.03, 0.7});
-
- // ----------------------------------------------------------------------------
- // Convert correlation matrix to a distance matrix:
- // ----------------------------------------------------------------------------
- double threshold = 0;
- for (size_t i = 0; i != correlations.size(); ++i) {
- for (size_t j = 0; j != correlations[i].size(); ++j) {
- // Here we check if our data comes from corelation matrix.
- if ((correlations[i][j] < -1) || (correlations[i][j] > 1)) {
- std::cerr << "The input matrix is not a correlation matrix. The program will now terminate.\n";
- throw "The input matrix is not a correlation matrix. The program will now terminate.\n";
- }
- correlations[i][j] = 1 - correlations[i][j];
- // Here we make sure that we will get the treshold value equal to maximal
- // distance in the matrix.
- if (correlations[i][j] > threshold) threshold = correlations[i][j];
- }
- }
-
- //-----------------------------------------------------------------------------
- // Now the correlation matrix is a distance matrix and can be processed further.
- //-----------------------------------------------------------------------------
- Distance_matrix distances = correlations;
-
- Rips_complex rips_complex_from_points(distances, threshold);
-
- Simplex_tree stree;
- rips_complex_from_points.create_complex(stree, 1);
- // ----------------------------------------------------------------------------
- // Display information about the one skeleton Rips complex. Note that
- // the filtration displayed here comes from the distance matrix computed
- // above, which is 1 - initial correlation matrix. Only this way, we obtain
- // a complex with filtration. If a correlation matrix is used instead, we would
- // have a reverse filtration (i.e. filtration of boundary of each simplex S
- // is greater or equal to the filtration of S).
- // ----------------------------------------------------------------------------
- std::cout << "Rips complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() << " simplices - "
- << stree.num_vertices() << " vertices." << std::endl;
-
- std::cout << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" << std::endl;
- for (auto f_simplex : stree.filtration_simplex_range()) {
- std::cout << " ( ";
- for (auto vertex : stree.simplex_vertex_range(f_simplex)) {
- std::cout << vertex << " ";
- }
- std::cout << ") -> "
- << "[" << stree.filtration(f_simplex) << "] ";
- std::cout << std::endl;
- }
-
- return 0;
-}
diff --git a/example/Rips_complex/example_one_skeleton_rips_from_distance_matrix.cpp b/example/Rips_complex/example_one_skeleton_rips_from_distance_matrix.cpp
deleted file mode 100644
index bbc3c755..00000000
--- a/example/Rips_complex/example_one_skeleton_rips_from_distance_matrix.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#include <gudhi/Rips_complex.h>
-#include <gudhi/Simplex_tree.h>
-#include <gudhi/distance_functions.h>
-
-#include <iostream>
-#include <string>
-#include <vector>
-#include <limits> // for std::numeric_limits
-
-int main() {
- // Type definitions
- using Simplex_tree = Gudhi::Simplex_tree<>;
- using Filtration_value = Simplex_tree::Filtration_value;
- using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
- using Distance_matrix = std::vector<std::vector<Filtration_value>>;
-
- // User defined distance matrix is:
- // | 0 0.94 0.77 0.99 0.11 |
- // | 0.94 0 0.26 0.99 0.39 |
- // | 0.77 0.26 0 0.28 0.97 |
- // | 0.99 0.99 0.28 0 0.30 |
- // | 0.11 0.39 0.97 0.30 0 |
-
- Distance_matrix distances;
- distances.push_back({});
- distances.push_back({0.94});
- distances.push_back({0.77, 0.26});
- distances.push_back({0.99, 0.99, 0.28});
- distances.push_back({0.11, 0.39, 0.97, 0.30});
-
- // ----------------------------------------------------------------------------
- // Init of a Rips complex from points
- // ----------------------------------------------------------------------------
- double threshold = 1.0;
- Rips_complex rips_complex_from_points(distances, threshold);
-
- Simplex_tree stree;
- rips_complex_from_points.create_complex(stree, 1);
- // ----------------------------------------------------------------------------
- // Display information about the one skeleton Rips complex
- // ----------------------------------------------------------------------------
- std::cout << "Rips complex is of dimension " << stree.dimension() <<
- " - " << stree.num_simplices() << " simplices - " <<
- stree.num_vertices() << " vertices." << std::endl;
-
- std::cout << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" <<
- std::endl;
- for (auto f_simplex : stree.filtration_simplex_range()) {
- std::cout << " ( ";
- for (auto vertex : stree.simplex_vertex_range(f_simplex)) {
- std::cout << vertex << " ";
- }
- std::cout << ") -> " << "[" << stree.filtration(f_simplex) << "] ";
- std::cout << std::endl;
- }
-
- return 0;
-}
diff --git a/example/Rips_complex/example_one_skeleton_rips_from_points.cpp b/example/Rips_complex/example_one_skeleton_rips_from_points.cpp
deleted file mode 100644
index a1db8910..00000000
--- a/example/Rips_complex/example_one_skeleton_rips_from_points.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-#include <gudhi/Rips_complex.h>
-#include <gudhi/Simplex_tree.h>
-#include <gudhi/distance_functions.h>
-
-#include <iostream>
-#include <string>
-#include <vector>
-#include <limits> // for std::numeric_limits
-
-int main() {
- // Type definitions
- using Point = std::vector<double>;
- using Simplex_tree = Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_fast_persistence>;
- using Filtration_value = Simplex_tree::Filtration_value;
- using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
-
- std::vector<Point> points;
- points.push_back({1.0, 1.0});
- points.push_back({7.0, 0.0});
- points.push_back({4.0, 6.0});
- points.push_back({9.0, 6.0});
- points.push_back({0.0, 14.0});
- points.push_back({2.0, 19.0});
- points.push_back({9.0, 17.0});
-
- // ----------------------------------------------------------------------------
- // Init of a Rips complex from points
- // ----------------------------------------------------------------------------
- double threshold = 12.0;
- Rips_complex rips_complex_from_points(points, threshold, Gudhi::Euclidean_distance());
-
- Simplex_tree stree;
- rips_complex_from_points.create_complex(stree, 1);
- // ----------------------------------------------------------------------------
- // Display information about the one skeleton Rips complex
- // ----------------------------------------------------------------------------
- std::cout << "Rips complex is of dimension " << stree.dimension() <<
- " - " << stree.num_simplices() << " simplices - " <<
- stree.num_vertices() << " vertices." << std::endl;
-
- std::cout << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" <<
- std::endl;
- for (auto f_simplex : stree.filtration_simplex_range()) {
- std::cout << " ( ";
- for (auto vertex : stree.simplex_vertex_range(f_simplex)) {
- std::cout << vertex << " ";
- }
- std::cout << ") -> " << "[" << stree.filtration(f_simplex) << "] ";
- std::cout << std::endl;
- }
- return 0;
-}
diff --git a/example/Rips_complex/example_rips_complex_from_csv_distance_matrix_file.cpp b/example/Rips_complex/example_rips_complex_from_csv_distance_matrix_file.cpp
deleted file mode 100644
index 9e182f1e..00000000
--- a/example/Rips_complex/example_rips_complex_from_csv_distance_matrix_file.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-#include <gudhi/Rips_complex.h>
-// to construct Rips_complex from a csv file representing a distance matrix
-#include <gudhi/reader_utils.h>
-#include <gudhi/Simplex_tree.h>
-#include <gudhi/distance_functions.h>
-
-#include <iostream>
-#include <string>
-#include <vector>
-
-void usage(int nbArgs, char * const progName) {
- std::cerr << "Error: Number of arguments (" << nbArgs << ") is not correct\n";
- std::cerr << "Usage: " << progName << " filename.csv threshold dim_max [ouput_file.txt]\n";
- std::cerr << " i.e.: " << progName << " ../../data/distance_matrix/full_square_distance_matrix.csv 1.0 3\n";
- exit(-1); // ----- >>
-}
-
-int main(int argc, char **argv) {
- if ((argc != 4) && (argc != 5)) usage(argc, (argv[0] - 1));
-
- std::string csv_file_name(argv[1]);
- double threshold = atof(argv[2]);
- int dim_max = atoi(argv[3]);
-
- // Type definitions
- using Simplex_tree = Gudhi::Simplex_tree<>;
- using Filtration_value = Simplex_tree::Filtration_value;
- using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
- using Distance_matrix = std::vector<std::vector<Filtration_value>>;
-
- // ----------------------------------------------------------------------------
- // Init of a Rips complex from a distance matrix in a csv file
- // Default separator is ';'
- // ----------------------------------------------------------------------------
- Distance_matrix distances = Gudhi::read_lower_triangular_matrix_from_csv_file<Filtration_value>(csv_file_name);
- Rips_complex rips_complex_from_file(distances, threshold);
-
- std::streambuf* streambufffer;
- std::ofstream ouput_file_stream;
-
- if (argc == 5) {
- ouput_file_stream.open(std::string(argv[4]));
- streambufffer = ouput_file_stream.rdbuf();
- } else {
- streambufffer = std::cout.rdbuf();
- }
-
- Simplex_tree stree;
- rips_complex_from_file.create_complex(stree, dim_max);
- std::ostream output_stream(streambufffer);
-
- // ----------------------------------------------------------------------------
- // Display information about the Rips complex
- // ----------------------------------------------------------------------------
- output_stream << "Rips complex is of dimension " << stree.dimension() <<
- " - " << stree.num_simplices() << " simplices - " <<
- stree.num_vertices() << " vertices." << std::endl;
-
- output_stream << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" <<
- std::endl;
- for (auto f_simplex : stree.filtration_simplex_range()) {
- output_stream << " ( ";
- for (auto vertex : stree.simplex_vertex_range(f_simplex)) {
- output_stream << vertex << " ";
- }
- output_stream << ") -> " << "[" << stree.filtration(f_simplex) << "] ";
- output_stream << std::endl;
- }
-
- ouput_file_stream.close();
- return 0;
-}
diff --git a/example/Rips_complex/example_rips_complex_from_off_file.cpp b/example/Rips_complex/example_rips_complex_from_off_file.cpp
deleted file mode 100644
index de2e4ea4..00000000
--- a/example/Rips_complex/example_rips_complex_from_off_file.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <gudhi/Rips_complex.h>
-// to construct Rips_complex from a OFF file of points
-#include <gudhi/Points_off_io.h>
-#include <gudhi/Simplex_tree.h>
-#include <gudhi/distance_functions.h>
-
-#include <iostream>
-#include <string>
-#include <vector>
-
-void usage(int nbArgs, char * const progName) {
- std::cerr << "Error: Number of arguments (" << nbArgs << ") is not correct\n";
- std::cerr << "Usage: " << progName << " filename.off threshold dim_max [ouput_file.txt]\n";
- std::cerr << " i.e.: " << progName << " ../../data/points/alphacomplexdoc.off 60.0\n";
- exit(-1); // ----- >>
-}
-
-int main(int argc, char **argv) {
- if ((argc != 4) && (argc != 5)) usage(argc, (argv[0] - 1));
-
- std::string off_file_name(argv[1]);
- double threshold = atof(argv[2]);
- int dim_max = atoi(argv[3]);
-
- // Type definitions
- using Point = std::vector<float>;
- using Simplex_tree = Gudhi::Simplex_tree<>;
- using Filtration_value = Simplex_tree::Filtration_value;
- using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
-
- // ----------------------------------------------------------------------------
- // 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, Gudhi::Euclidean_distance());
-
- std::streambuf* streambufffer;
- std::ofstream ouput_file_stream;
-
- if (argc == 5) {
- ouput_file_stream.open(std::string(argv[4]));
- streambufffer = ouput_file_stream.rdbuf();
- } else {
- streambufffer = std::cout.rdbuf();
- }
-
- Simplex_tree stree;
- rips_complex_from_file.create_complex(stree, dim_max);
- std::ostream output_stream(streambufffer);
-
- // ----------------------------------------------------------------------------
- // Display information about the Rips complex
- // ----------------------------------------------------------------------------
- output_stream << "Rips complex is of dimension " << stree.dimension() <<
- " - " << stree.num_simplices() << " simplices - " <<
- stree.num_vertices() << " vertices." << std::endl;
-
- output_stream << "Iterator on Rips complex simplices in the filtration order, with [filtration value]:" <<
- std::endl;
- for (auto f_simplex : stree.filtration_simplex_range()) {
- output_stream << " ( ";
- for (auto vertex : stree.simplex_vertex_range(f_simplex)) {
- output_stream << vertex << " ";
- }
- output_stream << ") -> " << "[" << stree.filtration(f_simplex) << "] ";
- output_stream << std::endl;
- }
-
- ouput_file_stream.close();
- return 0;
-}
diff --git a/example/Rips_complex/example_sparse_rips.cpp b/example/Rips_complex/example_sparse_rips.cpp
deleted file mode 100644
index 1c95b48c..00000000
--- a/example/Rips_complex/example_sparse_rips.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <gudhi/Sparse_rips_complex.h>
-#include <gudhi/Simplex_tree.h>
-#include <gudhi/distance_functions.h>
-
-#include <iostream>
-#include <vector>
-
-int main() {
- using Point = std::vector<double>;
- using Simplex_tree = Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_fast_persistence>;
- using Filtration_value = Simplex_tree::Filtration_value;
- using Sparse_rips = Gudhi::rips_complex::Sparse_rips_complex<Filtration_value>;
-
- Point points[] = {{1.0, 1.0}, {7.0, 0.0}, {4.0, 6.0}, {9.0, 6.0}, {0.0, 14.0}, {2.0, 19.0}, {9.0, 17.0}};
-
- // ----------------------------------------------------------------------------
- // Init from Euclidean points
- // ----------------------------------------------------------------------------
- double epsilon = 2; // very rough, no guarantees
- Sparse_rips sparse_rips(points, Gudhi::Euclidean_distance(), epsilon);
-
- Simplex_tree stree;
- sparse_rips.create_complex(stree, 10);
-
- // ----------------------------------------------------------------------------
- // Display information about the complex
- // ----------------------------------------------------------------------------
- std::cout << "Sparse Rips complex is of dimension " << stree.dimension() << " - " << stree.num_simplices()
- << " simplices - " << stree.num_vertices() << " vertices." << std::endl;
-}
diff --git a/example/Rips_complex/full_skeleton_rips_for_doc.txt b/example/Rips_complex/full_skeleton_rips_for_doc.txt
deleted file mode 100644
index 55de4ab8..00000000
--- a/example/Rips_complex/full_skeleton_rips_for_doc.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-Rips complex is of dimension 3 - 24 simplices - 7 vertices.
-Iterator on Rips complex simplices in the filtration order, with [filtration value]:
- ( 0 ) -> [0]
- ( 1 ) -> [0]
- ( 2 ) -> [0]
- ( 3 ) -> [0]
- ( 4 ) -> [0]
- ( 5 ) -> [0]
- ( 6 ) -> [0]
- ( 3 2 ) -> [5]
- ( 5 4 ) -> [5.38516]
- ( 2 0 ) -> [5.83095]
- ( 1 0 ) -> [6.08276]
- ( 3 1 ) -> [6.32456]
- ( 2 1 ) -> [6.7082]
- ( 2 1 0 ) -> [6.7082]
- ( 3 2 1 ) -> [6.7082]
- ( 6 5 ) -> [7.28011]
- ( 4 2 ) -> [8.94427]
- ( 3 0 ) -> [9.43398]
- ( 3 1 0 ) -> [9.43398]
- ( 3 2 0 ) -> [9.43398]
- ( 3 2 1 0 ) -> [9.43398]
- ( 6 4 ) -> [9.48683]
- ( 6 5 4 ) -> [9.48683]
- ( 6 3 ) -> [11]
diff --git a/example/Rips_complex/one_skeleton_rips_for_doc.txt b/example/Rips_complex/one_skeleton_rips_for_doc.txt
deleted file mode 100644
index 706512a5..00000000
--- a/example/Rips_complex/one_skeleton_rips_for_doc.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-Rips complex is of dimension 1 - 18 simplices - 7 vertices.
-Iterator on Rips complex simplices in the filtration order, with [filtration value]:
- ( 0 ) -> [0]
- ( 1 ) -> [0]
- ( 2 ) -> [0]
- ( 3 ) -> [0]
- ( 4 ) -> [0]
- ( 5 ) -> [0]
- ( 6 ) -> [0]
- ( 3 2 ) -> [5]
- ( 5 4 ) -> [5.38516]
- ( 2 0 ) -> [5.83095]
- ( 1 0 ) -> [6.08276]
- ( 3 1 ) -> [6.32456]
- ( 2 1 ) -> [6.7082]
- ( 6 5 ) -> [7.28011]
- ( 4 2 ) -> [8.94427]
- ( 3 0 ) -> [9.43398]
- ( 6 4 ) -> [9.48683]
- ( 6 3 ) -> [11]
diff --git a/example/Rips_complex/one_skeleton_rips_from_correlation_matrix_for_doc.txt b/example/Rips_complex/one_skeleton_rips_from_correlation_matrix_for_doc.txt
deleted file mode 100644
index 640d7083..00000000
--- a/example/Rips_complex/one_skeleton_rips_from_correlation_matrix_for_doc.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-Rips complex is of dimension 1 - 15 simplices - 5 vertices.
-Iterator on Rips complex simplices in the filtration order, with [filtration value]:
- ( 0 ) -> [0]
- ( 1 ) -> [0]
- ( 2 ) -> [0]
- ( 3 ) -> [0]
- ( 4 ) -> [0]
- ( 4 0 ) -> [0.11]
- ( 2 1 ) -> [0.26]
- ( 3 2 ) -> [0.28]
- ( 4 3 ) -> [0.3]
- ( 4 1 ) -> [0.39]
- ( 2 0 ) -> [0.77]
- ( 1 0 ) -> [0.94]
- ( 4 2 ) -> [0.97]
- ( 3 0 ) -> [0.99]
- ( 3 1 ) -> [0.99]
diff --git a/example/Simplex_tree/CMakeLists.txt b/example/Simplex_tree/CMakeLists.txt
deleted file mode 100644
index 857e8518..00000000
--- a/example/Simplex_tree/CMakeLists.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-project(Simplex_tree_examples)
-
-add_executable ( Simplex_tree_example_from_cliques_of_graph simplex_tree_from_cliques_of_graph.cpp )
-if (TBB_FOUND)
- target_link_libraries(Simplex_tree_example_from_cliques_of_graph ${TBB_LIBRARIES})
-endif()
-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 ( Simplex_tree_example_simple_simplex_tree simple_simplex_tree.cpp )
-if (TBB_FOUND)
- target_link_libraries(Simplex_tree_example_simple_simplex_tree ${TBB_LIBRARIES})
-endif()
-add_test(NAME Simplex_tree_example_simple_simplex_tree COMMAND $<TARGET_FILE:Simplex_tree_example_simple_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>)
-
-install(TARGETS Simplex_tree_example_from_cliques_of_graph DESTINATION bin)
-install(TARGETS Simplex_tree_example_simple_simplex_tree DESTINATION bin)
-install(TARGETS Simplex_tree_example_mini_simplex_tree DESTINATION bin)
-
-# An example with Simplex-tree using CGAL alpha_shapes_3
-if(GMP_FOUND AND CGAL_FOUND)
- 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})
- if (TBB_FOUND)
- target_link_libraries(Simplex_tree_example_alpha_shapes_3_from_off ${TBB_LIBRARIES})
- endif()
- 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")
-
- install(TARGETS Simplex_tree_example_alpha_shapes_3_from_off DESTINATION bin)
-
- add_executable ( Simplex_tree_example_cech_complex_cgal_mini_sphere_3d cech_complex_cgal_mini_sphere_3d.cpp )
- target_link_libraries(Simplex_tree_example_cech_complex_cgal_mini_sphere_3d ${Boost_PROGRAM_OPTIONS_LIBRARY} ${CGAL_LIBRARY})
- if (TBB_FOUND)
- target_link_libraries(Simplex_tree_example_cech_complex_cgal_mini_sphere_3d ${TBB_LIBRARIES})
- endif()
- add_test(NAME Simplex_tree_example_cech_complex_cgal_mini_sphere_3d COMMAND $<TARGET_FILE:Simplex_tree_example_cech_complex_cgal_mini_sphere_3d>
- "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" -r 0.3 -d 3)
-
- install(TARGETS Simplex_tree_example_alpha_shapes_3_from_off DESTINATION bin)
-endif()
-
-add_executable ( Simplex_tree_example_graph_expansion_with_blocker graph_expansion_with_blocker.cpp )
-if (TBB_FOUND)
- target_link_libraries(Simplex_tree_example_graph_expansion_with_blocker ${TBB_LIBRARIES})
-endif()
-add_test(NAME Simplex_tree_example_graph_expansion_with_blocker COMMAND $<TARGET_FILE:Simplex_tree_example_graph_expansion_with_blocker>)
-
-install(TARGETS Simplex_tree_example_graph_expansion_with_blocker DESTINATION bin)
diff --git a/example/Simplex_tree/README b/example/Simplex_tree/README
deleted file mode 100644
index a9498173..00000000
--- a/example/Simplex_tree/README
+++ /dev/null
@@ -1,73 +0,0 @@
-To build the example, run in a Terminal:
-
-cd /path-to-gudhi/
-cmake .
-cd /path-to-example/
-make
-
-
-Example of use :
-
-*** Simple simplex tree construction
-
-./Simplex_tree_example_simple_simplex_tree
-
-********************************************************************
-EXAMPLE OF SIMPLE INSERTION
- * INSERT 0
- + 0 INSERTED
- * INSERT 1
- + 1 INSERTED
- * INSERT (0,1)
- + (0,1) INSERTED
- * INSERT 2
- + 2 INSERTED
- * INSERT (2,0)
- + (2,0) INSERTED
- * INSERT (2,1)
- + (2,1) INSERTED
- * INSERT (2,1,0)
- + (2,1,0) INSERTED
- * INSERT 3
- + 3 INSERTED
- * INSERT (3,0)
- + (3,0) INSERTED
- * INSERT 0 (already inserted)
- - 0 NOT INSERTED
- * INSERT (2,1,0) (already inserted)
- - (2,1,0) NOT INSERTED
-********************************************************************
-* The complex contains 9 simplices
- - dimension 2 - filtration 0.4
-* Iterator on Simplices in the filtration, with [filtration value]:
- [0.1] 0
- [0.1] 1
- [0.1] 2
- [0.1] 3
- [0.2] 1 0
- [0.2] 2 0
- [0.2] 2 1
- [0.2] 3 0
- [0.3] 2 1 0
-
-*** Simplex tree construction with Z/2Z coefficients on weighted graph Klein bottle file:
-
-./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:
- Number of vertices = 10 Number of simplices = 82
-
-with Z/3Z coefficients:
-
-./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.
-Information of the Simplex Tree:
- Number of vertices = 10 Number of simplices = 106
-
-*** Simplex_tree computed and displayed from a 3D alpha complex:
- [ Requires CGAL, GMP and GMPXX to be installed]
-
-./Simplex_tree_example_alpha_shapes_3_from_off ../../../data/points/bunny_5000
diff --git a/example/Simplex_tree/cech_complex_cgal_mini_sphere_3d.cpp b/example/Simplex_tree/cech_complex_cgal_mini_sphere_3d.cpp
deleted file mode 100644
index 34092ef6..00000000
--- a/example/Simplex_tree/cech_complex_cgal_mini_sphere_3d.cpp
+++ /dev/null
@@ -1,221 +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.
- *
- * Author(s): Vincent Rouvreau
- *
- * 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/>.
- */
-
-#include <gudhi/graph_simplicial_complex.h>
-#include <gudhi/distance_functions.h>
-#include <gudhi/Simplex_tree.h>
-#include <gudhi/Points_off_io.h>
-
-#include <CGAL/Epick_d.h>
-#include <CGAL/Min_sphere_of_spheres_d.h>
-#include <CGAL/Min_sphere_of_points_d_traits_d.h>
-
-#include <boost/program_options.hpp>
-
-#include <string>
-#include <vector>
-#include <limits> // infinity
-#include <utility> // for pair
-#include <map>
-
-// -------------------------------------------------------------------------------
-// cech_complex_cgal_mini_sphere_3d is an example of each step that is required to
-// build a Cech over a Simplex_tree. Please refer to cech_persistence to see
-// how to do the same thing with the Cech_complex wrapper for less detailed
-// steps.
-// -------------------------------------------------------------------------------
-
-// Types definition
-using Simplex_tree = Gudhi::Simplex_tree<>;
-using Vertex_handle = Simplex_tree::Vertex_handle;
-using Simplex_handle = Simplex_tree::Simplex_handle;
-using Filtration_value = Simplex_tree::Filtration_value;
-using Siblings = Simplex_tree::Siblings;
-using Graph_t = boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS,
- boost::property<Gudhi::vertex_filtration_t, Filtration_value>,
- boost::property<Gudhi::edge_filtration_t, Filtration_value> >;
-using Edge_t = std::pair<Vertex_handle, Vertex_handle>;
-
-using Kernel = CGAL::Epick_d<CGAL::Dimension_tag<3> >;
-using Point = Kernel::Point_d;
-using Traits = CGAL::Min_sphere_of_points_d_traits_d<Kernel, Filtration_value, 3>;
-using Min_sphere = CGAL::Min_sphere_of_spheres_d<Traits>;
-
-using Points_off_reader = Gudhi::Points_off_reader<Point>;
-
-class Cech_blocker {
- public:
- bool operator()(Simplex_handle sh) {
- std::vector<Point> points;
-#if DEBUG_TRACES
- std::cout << "Cech_blocker on [";
-#endif // DEBUG_TRACES
- for (auto vertex : simplex_tree_.simplex_vertex_range(sh)) {
- points.push_back(point_cloud_[vertex]);
-#if DEBUG_TRACES
- std::cout << vertex << ", ";
-#endif // DEBUG_TRACES
- }
- Min_sphere ms(points.begin(), points.end());
- Filtration_value radius = ms.radius();
-#if DEBUG_TRACES
- std::cout << "] - radius = " << radius << " - returns " << (radius > threshold_) << std::endl;
-#endif // DEBUG_TRACES
- simplex_tree_.assign_filtration(sh, radius);
- return (radius > threshold_);
- }
- Cech_blocker(Simplex_tree& simplex_tree, Filtration_value threshold, const std::vector<Point>& point_cloud)
- : simplex_tree_(simplex_tree), threshold_(threshold), point_cloud_(point_cloud) {}
-
- private:
- Simplex_tree simplex_tree_;
- Filtration_value threshold_;
- std::vector<Point> point_cloud_;
-};
-
-template <typename InputPointRange>
-Graph_t compute_proximity_graph(InputPointRange& points, Filtration_value threshold);
-
-void program_options(int argc, char* argv[], std::string& off_file_points, Filtration_value& threshold, int& dim_max);
-
-int main(int argc, char* argv[]) {
- std::string off_file_points;
- Filtration_value threshold;
- int dim_max;
-
- program_options(argc, argv, off_file_points, threshold, dim_max);
-
- // Extract the points from the file filepoints
- Points_off_reader off_reader(off_file_points);
-
- // Compute the proximity graph of the points
- Graph_t prox_graph = compute_proximity_graph(off_reader.get_point_cloud(), threshold);
-
- // Min_sphere sph1(off_reader.get_point_cloud()[0], off_reader.get_point_cloud()[1], off_reader.get_point_cloud()[2]);
- // Construct the Rips complex in a Simplex Tree
- Simplex_tree st;
- // insert the proximity graph in the simplex tree
- st.insert_graph(prox_graph);
- // expand the graph until dimension dim_max
- st.expansion_with_blockers(dim_max, Cech_blocker(st, threshold, off_reader.get_point_cloud()));
-
- std::cout << "The complex contains " << st.num_simplices() << " simplices \n";
- std::cout << " and has dimension " << st.dimension() << " \n";
-
- // Sort the simplices in the order of the filtration
- st.initialize_filtration();
-
-#if DEBUG_TRACES
- std::cout << "********************************************************************\n";
- // Display the Simplex_tree - Can not be done in the middle of 2 inserts
- std::cout << "* The complex contains " << st.num_simplices() << " simplices - dimension=" << st.dimension() << "\n";
- std::cout << "* Iterator on Simplices in the filtration, with [filtration value]:\n";
- for (auto f_simplex : st.filtration_simplex_range()) {
- std::cout << " "
- << "[" << st.filtration(f_simplex) << "] ";
- for (auto vertex : st.simplex_vertex_range(f_simplex)) {
- std::cout << static_cast<int>(vertex) << " ";
- }
- std::cout << std::endl;
- }
-#endif // DEBUG_TRACES
- return 0;
-}
-
-void program_options(int argc, char* argv[], std::string& off_file_points, Filtration_value& threshold, int& dim_max) {
- namespace po = boost::program_options;
- po::options_description hidden("Hidden options");
- hidden.add_options()("input-file", po::value<std::string>(&off_file_points),
- "Name of an OFF file containing a 3d point set.\n");
-
- po::options_description visible("Allowed options", 100);
- visible.add_options()("help,h", "produce help message")(
- "max-edge-length,r",
- po::value<Filtration_value>(&threshold)->default_value(std::numeric_limits<Filtration_value>::infinity()),
- "Maximal length of an edge for the Cech complex construction.")(
- "cpx-dimension,d", po::value<int>(&dim_max)->default_value(1),
- "Maximal dimension of the Cech complex we want to compute.");
-
- po::positional_options_description pos;
- pos.add("input-file", 1);
-
- po::options_description all;
- all.add(visible).add(hidden);
-
- po::variables_map vm;
- po::store(po::command_line_parser(argc, argv).options(all).positional(pos).run(), vm);
- po::notify(vm);
-
- if (vm.count("help") || !vm.count("input-file")) {
- std::cout << std::endl;
- std::cout << "Construct a Cech complex defined on a set of input points.\n \n";
-
- std::cout << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl;
- std::cout << visible << std::endl;
- exit(-1);
- }
-}
-
-/** Output the proximity graph of the points.
- *
- * If points contains n elements, the proximity graph is the graph
- * with n vertices, and an edge [u,v] iff the distance function between
- * points u and v is smaller than threshold.
- *
- * The type PointCloud furnishes .begin() and .end() methods, that return
- * iterators with value_type Point.
- */
-template <typename InputPointRange>
-Graph_t compute_proximity_graph(InputPointRange& points, Filtration_value threshold) {
- std::vector<Edge_t> edges;
- std::vector<Filtration_value> edges_fil;
-
- Kernel k;
- Vertex_handle idx_u, idx_v;
- Filtration_value fil;
- idx_u = 0;
- for (auto it_u = points.begin(); it_u != points.end(); ++it_u) {
- idx_v = idx_u + 1;
- for (auto it_v = it_u + 1; it_v != points.end(); ++it_v, ++idx_v) {
- fil = k.squared_distance_d_object()(*it_u, *it_v);
- // For Cech Complex, threshold is a radius (distance /2)
- fil = std::sqrt(fil) / 2.;
- if (fil <= threshold) {
- edges.emplace_back(idx_u, idx_v);
- edges_fil.push_back(fil);
- }
- }
- ++idx_u;
- }
-
- Graph_t skel_graph(edges.begin(), edges.end(), edges_fil.begin(),
- idx_u); // number of points labeled from 0 to idx_u-1
-
- auto vertex_prop = boost::get(Gudhi::vertex_filtration_t(), skel_graph);
-
- boost::graph_traits<Graph_t>::vertex_iterator vi, vi_end;
- for (std::tie(vi, vi_end) = boost::vertices(skel_graph); vi != vi_end; ++vi) {
- boost::put(vertex_prop, *vi, 0.);
- }
-
- return skel_graph;
-}
diff --git a/example/Simplex_tree/example_alpha_shapes_3_simplex_tree_from_off_file.cpp b/example/Simplex_tree/example_alpha_shapes_3_simplex_tree_from_off_file.cpp
deleted file mode 100644
index 290a9d9b..00000000
--- a/example/Simplex_tree/example_alpha_shapes_3_simplex_tree_from_off_file.cpp
+++ /dev/null
@@ -1,276 +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.
- *
- * Author(s): Vincent Rouvreau
- *
- * Copyright (C) 2014 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/Simplex_tree.h>
-#include <gudhi/Points_3D_off_io.h>
-
-#include <boost/variant.hpp>
-
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Delaunay_triangulation_3.h>
-#include <CGAL/Alpha_shape_3.h>
-#include <CGAL/Alpha_shape_vertex_base_3.h>
-#include <CGAL/Alpha_shape_cell_base_3.h>
-#include <CGAL/iterator.h>
-
-#include <fstream>
-#include <cmath>
-#include <string>
-#include <tuple> // for tuple<>
-#include <map>
-#include <utility> // for pair<>
-#include <list>
-#include <vector>
-
-// Alpha_shape_3 templates type definitions
-typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
-typedef CGAL::Alpha_shape_vertex_base_3<Kernel> Vb;
-typedef CGAL::Alpha_shape_cell_base_3<Kernel> Fb;
-typedef CGAL::Triangulation_data_structure_3<Vb, Fb> Tds;
-typedef CGAL::Delaunay_triangulation_3<Kernel, Tds> Triangulation_3;
-typedef CGAL::Alpha_shape_3<Triangulation_3> Alpha_shape_3;
-
-// From file type definition
-typedef Kernel::Point_3 Point;
-
-// filtration with alpha values needed type definition
-typedef Alpha_shape_3::FT Alpha_value_type;
-typedef CGAL::Object Object;
-typedef CGAL::Dispatch_output_iterator<
-CGAL::cpp11::tuple<Object, Alpha_value_type>,
-CGAL::cpp11::tuple<std::back_insert_iterator< std::vector<Object> >,
- std::back_insert_iterator< std::vector<Alpha_value_type> > > > Dispatch;
-typedef Alpha_shape_3::Cell_handle Cell_handle;
-typedef Alpha_shape_3::Facet Facet;
-typedef Alpha_shape_3::Edge Edge;
-typedef std::list<Alpha_shape_3::Vertex_handle> Vertex_list;
-
-// gudhi type definition
-typedef Gudhi::Simplex_tree<> Simplex_tree;
-typedef Simplex_tree::Vertex_handle Simplex_tree_vertex;
-typedef std::map<Alpha_shape_3::Vertex_handle, Simplex_tree_vertex > Alpha_shape_simplex_tree_map;
-typedef std::pair<Alpha_shape_3::Vertex_handle, Simplex_tree_vertex> Alpha_shape_simplex_tree_pair;
-typedef std::vector< Simplex_tree_vertex > Simplex_tree_vector_vertex;
-
-Vertex_list from(const Cell_handle& ch) {
- Vertex_list the_list;
- for (auto i = 0; i < 4; i++) {
-#ifdef DEBUG_TRACES
- std::cout << "from cell[" << i << "]=" << ch->vertex(i)->point() << std::endl;
-#endif // DEBUG_TRACES
- the_list.push_back(ch->vertex(i));
- }
- return the_list;
-}
-
-Vertex_list from(const Facet& fct) {
- Vertex_list the_list;
- for (auto i = 0; i < 4; i++) {
- if (fct.second != i) {
-#ifdef DEBUG_TRACES
- std::cout << "from facet=[" << i << "]" << fct.first->vertex(i)->point() << std::endl;
-#endif // DEBUG_TRACES
- the_list.push_back(fct.first->vertex(i));
- }
- }
- return the_list;
-}
-
-Vertex_list from(const Edge& edg) {
- Vertex_list the_list;
- for (auto i = 0; i < 4; i++) {
- if ((edg.second == i) || (edg.third == i)) {
-#ifdef DEBUG_TRACES
- std::cout << "from edge[" << i << "]=" << edg.first->vertex(i)->point() << std::endl;
-#endif // DEBUG_TRACES
- the_list.push_back(edg.first->vertex(i));
- }
- }
- return the_list;
-}
-
-Vertex_list from(const Alpha_shape_3::Vertex_handle& vh) {
- Vertex_list the_list;
-#ifdef DEBUG_TRACES
- std::cout << "from vertex=" << vh->point() << std::endl;
-#endif // DEBUG_TRACES
- the_list.push_back(vh);
- return the_list;
-}
-
-int main(int argc, char * const argv[]) {
- // program args management
- if (argc != 2) {
- std::cerr << "Usage: " << argv[0]
- << " path_to_off_file \n";
- return 0;
- }
-
- // Read points from file
- std::string offInputFile(argv[1]);
- // Read the OFF file (input file name given as parameter) and triangulate points
- Gudhi::Points_3D_off_reader<Point> off_reader(offInputFile);
- // Check the read operation was correct
- if (!off_reader.is_valid()) {
- std::cerr << "Unable to read file " << argv[1] << std::endl;
- return 0;
- }
- // Retrieve the triangulation
- std::vector<Point> lp = off_reader.get_point_cloud();
-
- // alpha shape construction from points. CGAL has a strange behavior in REGULARIZED mode.
- Alpha_shape_3 as(lp.begin(), lp.end(), 0, Alpha_shape_3::GENERAL);
-#ifdef DEBUG_TRACES
- std::cout << "Alpha shape computed in GENERAL mode" << std::endl;
-#endif // DEBUG_TRACES
-
- // filtration with alpha values from alpha shape
- std::vector<Object> the_objects;
- std::vector<Alpha_value_type> the_alpha_values;
-
- Dispatch disp = CGAL::dispatch_output<Object, Alpha_value_type>(std::back_inserter(the_objects),
- std::back_inserter(the_alpha_values));
-
- as.filtration_with_alpha_values(disp);
-#ifdef DEBUG_TRACES
- std::cout << "filtration_with_alpha_values returns : " << the_objects.size() << " objects" << std::endl;
-#endif // DEBUG_TRACES
-
- Alpha_shape_3::size_type count_vertices = 0;
- Alpha_shape_3::size_type count_edges = 0;
- Alpha_shape_3::size_type count_facets = 0;
- Alpha_shape_3::size_type count_cells = 0;
-
- // Loop on objects vector
- Vertex_list vertex_list;
- Simplex_tree simplex_tree;
- Alpha_shape_simplex_tree_map map_cgal_simplex_tree;
- std::vector<Alpha_value_type>::iterator the_alpha_value_iterator = the_alpha_values.begin();
- for (auto object_iterator : the_objects) {
- // Retrieve Alpha shape vertex list from object
- if (const Cell_handle * cell = CGAL::object_cast<Cell_handle>(&object_iterator)) {
- vertex_list = from(*cell);
- count_cells++;
- } else if (const Facet * facet = CGAL::object_cast<Facet>(&object_iterator)) {
- vertex_list = from(*facet);
- count_facets++;
- } else if (const Edge * edge = CGAL::object_cast<Edge>(&object_iterator)) {
- vertex_list = from(*edge);
- count_edges++;
- } else if (const Alpha_shape_3::Vertex_handle * vertex =
- CGAL::object_cast<Alpha_shape_3::Vertex_handle>(&object_iterator)) {
- count_vertices++;
- vertex_list = from(*vertex);
- }
- // Construction of the vector of simplex_tree vertex from list of alpha_shapes vertex
- Simplex_tree_vector_vertex the_simplex_tree;
- for (auto the_alpha_shape_vertex : vertex_list) {
- Alpha_shape_simplex_tree_map::iterator the_map_iterator = map_cgal_simplex_tree.find(the_alpha_shape_vertex);
- if (the_map_iterator == map_cgal_simplex_tree.end()) {
- // alpha shape not found
- Simplex_tree_vertex vertex = map_cgal_simplex_tree.size();
-#ifdef DEBUG_TRACES
- std::cout << "vertex [" << the_alpha_shape_vertex->point() << "] not found - insert_simplex " << vertex << "\n";
-#endif // DEBUG_TRACES
- the_simplex_tree.push_back(vertex);
- map_cgal_simplex_tree.insert(Alpha_shape_simplex_tree_pair(the_alpha_shape_vertex, vertex));
- } else {
- // alpha shape found
- Simplex_tree_vertex vertex = the_map_iterator->second;
-#ifdef DEBUG_TRACES
- std::cout << "vertex [" << the_alpha_shape_vertex->point() << "] found in " << vertex << std::endl;
-#endif // DEBUG_TRACES
- the_simplex_tree.push_back(vertex);
- }
- }
- // Construction of the simplex_tree
-#ifdef DEBUG_TRACES
- std::cout << "filtration = " << *the_alpha_value_iterator << std::endl;
-#endif // DEBUG_TRACES
- simplex_tree.insert_simplex(the_simplex_tree, std::sqrt(*the_alpha_value_iterator));
- if (the_alpha_value_iterator != the_alpha_values.end())
- ++the_alpha_value_iterator;
- else
- std::cerr << "This shall not happen" << std::endl;
- }
-#ifdef DEBUG_TRACES
- std::cout << "vertices \t\t" << count_vertices << std::endl;
- std::cout << "edges \t\t" << count_edges << std::endl;
- std::cout << "facets \t\t" << count_facets << std::endl;
- std::cout << "cells \t\t" << count_cells << std::endl;
-
-
- std::cout << "Information of the Simplex Tree:\n";
- std::cout << " Number of vertices = " << simplex_tree.num_vertices() << " ";
- std::cout << " Number of simplices = " << simplex_tree.num_simplices() << std::endl << std::endl;
-#endif // DEBUG_TRACES
-
-#ifdef DEBUG_TRACES
- std::cout << "Iterator on vertices: \n";
- for (auto vertex : simplex_tree.complex_vertex_range()) {
- std::cout << vertex << " ";
- }
-#endif // DEBUG_TRACES
-
- std::cout << simplex_tree << std::endl;
-
-#ifdef DEBUG_TRACES
- std::cout << std::endl << std::endl << "Iterator on simplices:\n";
- for (auto simplex : simplex_tree.complex_simplex_range()) {
- std::cout << " ";
- for (auto vertex : simplex_tree.simplex_vertex_range(simplex)) {
- std::cout << vertex << " ";
- }
- std::cout << std::endl;
- }
-#endif // DEBUG_TRACES
-#ifdef DEBUG_TRACES
- std::cout << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:\n";
- for (auto f_simplex : simplex_tree.filtration_simplex_range()) {
- std::cout << " " << "[" << simplex_tree.filtration(f_simplex) << "] ";
- for (auto vertex : simplex_tree.simplex_vertex_range(f_simplex)) {
- std::cout << vertex << " ";
- }
- std::cout << std::endl;
- }
-#endif // DEBUG_TRACES
-#ifdef DEBUG_TRACES
- std::cout << std::endl << std::endl << "Iterator on Simplices in the filtration, and their boundary simplices:\n";
- for (auto f_simplex : simplex_tree.filtration_simplex_range()) {
- std::cout << " " << "[" << simplex_tree.filtration(f_simplex) << "] ";
- for (auto vertex : simplex_tree.simplex_vertex_range(f_simplex)) {
- std::cout << vertex << " ";
- }
- std::cout << std::endl;
-
- for (auto b_simplex : simplex_tree.boundary_simplex_range(f_simplex)) {
- std::cout << " " << "[" << simplex_tree.filtration(b_simplex) << "] ";
- for (auto vertex : simplex_tree.simplex_vertex_range(b_simplex)) {
- std::cout << vertex << " ";
- }
- std::cout << std::endl;
- }
- }
-#endif // DEBUG_TRACES
-
- return 0;
-}
diff --git a/example/Simplex_tree/graph_expansion_with_blocker.cpp b/example/Simplex_tree/graph_expansion_with_blocker.cpp
deleted file mode 100644
index f39de31f..00000000
--- a/example/Simplex_tree/graph_expansion_with_blocker.cpp
+++ /dev/null
@@ -1,77 +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.
- *
- * Author(s): Vincent Rouvreau
- *
- * Copyright (C) 2014 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/Simplex_tree.h>
-
-#include <iostream>
-
-using Simplex_tree = Gudhi::Simplex_tree<>;
-using Simplex_handle = Simplex_tree::Simplex_handle;
-
-int main(int argc, char* const argv[]) {
- // Construct the Simplex Tree with a 1-skeleton graph example
- Simplex_tree stree;
-
- stree.insert_simplex({0, 1}, 0.);
- stree.insert_simplex({0, 2}, 1.);
- stree.insert_simplex({0, 3}, 2.);
- stree.insert_simplex({1, 2}, 3.);
- stree.insert_simplex({1, 3}, 4.);
- stree.insert_simplex({2, 3}, 5.);
- stree.insert_simplex({2, 4}, 6.);
- stree.insert_simplex({3, 6}, 7.);
- stree.insert_simplex({4, 5}, 8.);
- stree.insert_simplex({4, 6}, 9.);
- stree.insert_simplex({5, 6}, 10.);
- stree.insert_simplex({6}, 10.);
-
- stree.expansion_with_blockers(3, [&](Simplex_handle sh) {
- bool result = false;
- std::cout << "Blocker on [";
- // User can loop on the vertices from the given simplex_handle i.e.
- for (auto vertex : stree.simplex_vertex_range(sh)) {
- // We block the expansion, if the vertex '6' is in the given list of vertices
- if (vertex == 6) result = true;
- std::cout << vertex << ", ";
- }
- std::cout << "] ( " << stree.filtration(sh);
- // User can re-assign a new filtration value directly in the blocker (default is the maximal value of boudaries)
- stree.assign_filtration(sh, stree.filtration(sh) + 1.);
-
- std::cout << " + 1. ) = " << result << std::endl;
-
- return result;
- });
-
- std::cout << "********************************************************************\n";
- std::cout << "* The complex contains " << stree.num_simplices() << " simplices";
- std::cout << " - dimension " << stree.dimension() << "\n";
- std::cout << "* Iterator on Simplices in the filtration, with [filtration value]:\n";
- for (auto f_simplex : stree.filtration_simplex_range()) {
- std::cout << " "
- << "[" << stree.filtration(f_simplex) << "] ";
- for (auto vertex : stree.simplex_vertex_range(f_simplex)) std::cout << "(" << vertex << ")";
- std::cout << std::endl;
- }
-
- return 0;
-}
diff --git a/example/Simplex_tree/mini_simplex_tree.cpp b/example/Simplex_tree/mini_simplex_tree.cpp
deleted file mode 100644
index e7c7177f..00000000
--- a/example/Simplex_tree/mini_simplex_tree.cpp
+++ /dev/null
@@ -1,66 +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.
- *
- * Author(s): Marc Glisse
- *
- * 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/Simplex_tree.h>
-#include <iostream>
-#include <initializer_list>
-
-struct MyOptions : Gudhi::Simplex_tree_options_full_featured {
- // Not doing persistence, so we don't need those
- static const bool store_key = false;
- static const bool store_filtration = false;
- // I have few vertices
- typedef short Vertex_handle;
-};
-
-using ST = Gudhi::Simplex_tree<MyOptions>;
-
-// Dictionary should be private, but for now this is the easiest way.
-static_assert(sizeof(ST::Dictionary::value_type) < sizeof(Gudhi::Simplex_tree<>::Dictionary::value_type),
- "Not storing the filtration and key should save some space");
-
-int main() {
- ST st;
-
- /* Complex to build. */
- /* 1 */
- /* o */
- /* /X\ */
- /* o---o---o */
- /* 2 0 3 */
-
- auto triangle012 = {0, 1, 2};
- auto edge03 = {0, 3};
- st.insert_simplex_and_subfaces(triangle012);
- st.insert_simplex_and_subfaces(edge03);
-
- auto edge02 = {0, 2};
- ST::Simplex_handle e = st.find(edge02);
- // We are not using filtrations so everything has value 0
- assert(st.filtration(e) == 0);
- for (ST::Simplex_handle t : st.cofaces_simplex_range(e, 1)) {
- // Only coface is 012
- for (ST::Vertex_handle v : st.simplex_vertex_range(t)) // v in { 0, 1, 2 }
- std::cout << v;
- std::cout << '\n';
- }
-}
diff --git a/example/Simplex_tree/simple_simplex_tree.cpp b/example/Simplex_tree/simple_simplex_tree.cpp
deleted file mode 100644
index d71b5608..00000000
--- a/example/Simplex_tree/simple_simplex_tree.cpp
+++ /dev/null
@@ -1,268 +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.
- *
- * Author(s): Vincent Rouvreau
- *
- * Copyright (C) 2014 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/graph_simplicial_complex.h>
-#include <gudhi/Simplex_tree.h>
-
-#include <iostream>
-#include <utility> // for pair
-#include <vector>
-
-using Simplex_tree = Gudhi::Simplex_tree<>;
-using Vertex_handle = Simplex_tree::Vertex_handle;
-using Filtration_value = Simplex_tree::Filtration_value;
-using typeVectorVertex = std::vector<Vertex_handle>;
-using typePairSimplexBool = std::pair<Simplex_tree::Simplex_handle, bool>;
-
-int main(int argc, char* const argv[]) {
- const Filtration_value FIRST_FILTRATION_VALUE = 0.1;
- const Filtration_value SECOND_FILTRATION_VALUE = 0.2;
- const Filtration_value THIRD_FILTRATION_VALUE = 0.3;
- const Filtration_value FOURTH_FILTRATION_VALUE = 0.4;
-
- // TEST OF INSERTION
- std::cout << "********************************************************************" << std::endl;
- std::cout << "EXAMPLE OF SIMPLE INSERTION" << std::endl;
- // Construct the Simplex Tree
- Simplex_tree simplexTree;
-
- /* Simplex to be inserted: */
- /* 1 */
- /* o */
- /* /X\ */
- /* o---o---o */
- /* 2 0 3 */
-
- // ++ FIRST
- std::cout << " * INSERT 0" << std::endl;
- typeVectorVertex firstSimplexVector = {0};
- typePairSimplexBool returnValue =
- simplexTree.insert_simplex(firstSimplexVector, Filtration_value(FIRST_FILTRATION_VALUE));
-
- if (returnValue.second == true) {
- std::cout << " + 0 INSERTED" << std::endl;
- } else {
- std::cout << " - 0 NOT INSERTED" << std::endl;
- }
-
- // ++ SECOND
- std::cout << " * INSERT 1" << std::endl;
- typeVectorVertex secondSimplexVector = {1};
- returnValue = simplexTree.insert_simplex(secondSimplexVector, Filtration_value(FIRST_FILTRATION_VALUE));
-
- if (returnValue.second == true) {
- std::cout << " + 1 INSERTED" << std::endl;
- } else {
- std::cout << " - 1 NOT INSERTED" << std::endl;
- }
-
- // ++ THIRD
- std::cout << " * INSERT (0,1)" << std::endl;
- typeVectorVertex thirdSimplexVector = {0, 1};
- returnValue = simplexTree.insert_simplex(thirdSimplexVector, Filtration_value(SECOND_FILTRATION_VALUE));
-
- if (returnValue.second == true) {
- std::cout << " + (0,1) INSERTED" << std::endl;
- } else {
- std::cout << " - (0,1) NOT INSERTED" << std::endl;
- }
-
- // ++ FOURTH
- std::cout << " * INSERT 2" << std::endl;
- typeVectorVertex fourthSimplexVector = {2};
- returnValue = simplexTree.insert_simplex(fourthSimplexVector, Filtration_value(FIRST_FILTRATION_VALUE));
-
- if (returnValue.second == true) {
- std::cout << " + 2 INSERTED" << std::endl;
- } else {
- std::cout << " - 2 NOT INSERTED" << std::endl;
- }
-
- // ++ FIFTH
- std::cout << " * INSERT (2,0)" << std::endl;
- typeVectorVertex fifthSimplexVector = {2, 0};
- returnValue = simplexTree.insert_simplex(fifthSimplexVector, Filtration_value(SECOND_FILTRATION_VALUE));
-
- if (returnValue.second == true) {
- std::cout << " + (2,0) INSERTED" << std::endl;
- } else {
- std::cout << " - (2,0) NOT INSERTED" << std::endl;
- }
-
- // ++ SIXTH
- std::cout << " * INSERT (2,1)" << std::endl;
- typeVectorVertex sixthSimplexVector = {2, 1};
- returnValue = simplexTree.insert_simplex(sixthSimplexVector, Filtration_value(SECOND_FILTRATION_VALUE));
-
- if (returnValue.second == true) {
- std::cout << " + (2,1) INSERTED" << std::endl;
- } else {
- std::cout << " - (2,1) NOT INSERTED" << std::endl;
- }
-
- // ++ SEVENTH
- std::cout << " * INSERT (2,1,0)" << std::endl;
- typeVectorVertex seventhSimplexVector = {2, 1, 0};
- returnValue = simplexTree.insert_simplex(seventhSimplexVector, Filtration_value(THIRD_FILTRATION_VALUE));
-
- if (returnValue.second == true) {
- std::cout << " + (2,1,0) INSERTED" << std::endl;
- } else {
- std::cout << " - (2,1,0) NOT INSERTED" << std::endl;
- }
-
- // ++ EIGHTH
- std::cout << " * INSERT 3" << std::endl;
- typeVectorVertex eighthSimplexVector = {3};
- returnValue = simplexTree.insert_simplex(eighthSimplexVector, Filtration_value(FIRST_FILTRATION_VALUE));
-
- if (returnValue.second == true) {
- std::cout << " + 3 INSERTED" << std::endl;
- } else {
- std::cout << " - 3 NOT INSERTED" << std::endl;
- }
-
- // ++ NINETH
- std::cout << " * INSERT (3,0)" << std::endl;
- typeVectorVertex ninethSimplexVector = {3, 0};
- returnValue = simplexTree.insert_simplex(ninethSimplexVector, Filtration_value(SECOND_FILTRATION_VALUE));
-
- if (returnValue.second == true) {
- std::cout << " + (3,0) INSERTED" << std::endl;
- } else {
- std::cout << " - (3,0) NOT INSERTED" << std::endl;
- }
-
- // ++ TENTH
- std::cout << " * INSERT 0 (already inserted)" << std::endl;
- typeVectorVertex tenthSimplexVector = {0};
- // With a different filtration value
- returnValue = simplexTree.insert_simplex(tenthSimplexVector, Filtration_value(FOURTH_FILTRATION_VALUE));
-
- if (returnValue.second == true) {
- std::cout << " + 0 INSERTED" << std::endl;
- } else {
- std::cout << " - 0 NOT INSERTED" << std::endl;
- }
-
- // ++ ELEVENTH
- std::cout << " * INSERT (2,1,0) (already inserted)" << std::endl;
- typeVectorVertex eleventhSimplexVector = {2, 1, 0};
- returnValue = simplexTree.insert_simplex(eleventhSimplexVector, Filtration_value(FOURTH_FILTRATION_VALUE));
-
- if (returnValue.second == true) {
- std::cout << " + (2,1,0) INSERTED" << std::endl;
- } else {
- std::cout << " - (2,1,0) NOT INSERTED" << std::endl;
- }
-
- // ++ GENERAL VARIABLE SET
-
- std::cout << "********************************************************************\n";
- // Display the Simplex_tree - Can not be done in the middle of 2 inserts
- std::cout << "* The complex contains " << simplexTree.num_simplices() << " simplices\n";
- std::cout << " - dimension " << simplexTree.dimension() << "\n";
- std::cout << "* Iterator on Simplices in the filtration, with [filtration value]:\n";
- for (auto f_simplex : simplexTree.filtration_simplex_range()) {
- std::cout << " "
- << "[" << simplexTree.filtration(f_simplex) << "] ";
- for (auto vertex : simplexTree.simplex_vertex_range(f_simplex)) std::cout << "(" << vertex << ")";
- std::cout << std::endl;
- }
- // [0.1] 0
- // [0.1] 1
- // [0.1] 2
- // [0.1] 3
- // [0.2] 1 0
- // [0.2] 2 0
- // [0.2] 2 1
- // [0.2] 3 0
- // [0.3] 2 1 0
-
- // ------------------------------------------------------------------------------------------------------------------
- // Find in the simplex_tree
- // ------------------------------------------------------------------------------------------------------------------
- Simplex_tree::Simplex_handle simplexFound = simplexTree.find(secondSimplexVector);
- std::cout << "**************IS THE SIMPLEX {1} IN THE SIMPLEX TREE ?\n";
- if (simplexFound != simplexTree.null_simplex())
- std::cout << "***+ YES IT IS!\n";
- else
- std::cout << "***- NO IT ISN'T\n";
-
- typeVectorVertex unknownSimplexVector = {15};
- simplexFound = simplexTree.find(unknownSimplexVector);
- std::cout << "**************IS THE SIMPLEX {15} IN THE SIMPLEX TREE ?\n";
- if (simplexFound != simplexTree.null_simplex())
- std::cout << "***+ YES IT IS!\n";
- else
- std::cout << "***- NO IT ISN'T\n";
-
- simplexFound = simplexTree.find(fifthSimplexVector);
- std::cout << "**************IS THE SIMPLEX {2,0} IN THE SIMPLEX TREE ?\n";
- if (simplexFound != simplexTree.null_simplex())
- std::cout << "***+ YES IT IS!\n";
- else
- std::cout << "***- NO IT ISN'T\n";
-
- typeVectorVertex otherSimplexVector = {1, 15};
- simplexFound = simplexTree.find(otherSimplexVector);
- std::cout << "**************IS THE SIMPLEX {15,1} IN THE SIMPLEX TREE ?\n";
- if (simplexFound != simplexTree.null_simplex())
- std::cout << "***+ YES IT IS!\n";
- else
- std::cout << "***- NO IT ISN'T\n";
-
- typeVectorVertex invSimplexVector = {1, 2, 0};
- simplexFound = simplexTree.find(invSimplexVector);
- std::cout << "**************IS THE SIMPLEX {1,2,0} IN THE SIMPLEX TREE ?\n";
- if (simplexFound != simplexTree.null_simplex())
- std::cout << "***+ YES IT IS!\n";
- else
- std::cout << "***- NO IT ISN'T\n";
-
- simplexFound = simplexTree.find({0, 1});
- std::cout << "**************IS THE SIMPLEX {0,1} IN THE SIMPLEX TREE ?\n";
- if (simplexFound != simplexTree.null_simplex())
- std::cout << "***+ YES IT IS!\n";
- else
- std::cout << "***- NO IT ISN'T\n";
-
- std::cout << "**************COFACES OF {0,1} IN CODIMENSION 1 ARE\n";
- for (auto& simplex : simplexTree.cofaces_simplex_range(simplexTree.find({0, 1}), 1)) {
- for (auto vertex : simplexTree.simplex_vertex_range(simplex)) std::cout << "(" << vertex << ")";
- std::cout << std::endl;
- }
-
- std::cout << "**************STARS OF {0,1} ARE\n";
- for (auto& simplex : simplexTree.star_simplex_range(simplexTree.find({0, 1}))) {
- for (auto vertex : simplexTree.simplex_vertex_range(simplex)) std::cout << "(" << vertex << ")";
- std::cout << std::endl;
- }
-
- std::cout << "**************BOUNDARIES OF {0,1,2} ARE\n";
- for (auto& simplex : simplexTree.boundary_simplex_range(simplexTree.find({0, 1, 2}))) {
- for (auto vertex : simplexTree.simplex_vertex_range(simplex)) std::cout << "(" << vertex << ")";
- std::cout << std::endl;
- }
-
- return 0;
-}
diff --git a/example/Simplex_tree/simplex_tree_from_cliques_of_graph.cpp b/example/Simplex_tree/simplex_tree_from_cliques_of_graph.cpp
deleted file mode 100644
index 6d70f3d1..00000000
--- a/example/Simplex_tree/simplex_tree_from_cliques_of_graph.cpp
+++ /dev/null
@@ -1,121 +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.
- *
- * Author(s): Clément Maria
- *
- * Copyright (C) 2014 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/reader_utils.h>
-#include <gudhi/Simplex_tree.h>
-
-#include <iostream>
-#include <ctime>
-#include <string>
-#include <utility> // for std::pair
-
-using namespace Gudhi;
-
-typedef int Vertex_handle;
-typedef double Filtration_value;
-typedef boost::adjacency_list < boost::vecS, boost::vecS, boost::undirectedS,
- boost::property < vertex_filtration_t, Filtration_value >,
- boost::property < edge_filtration_t, Filtration_value > > Graph_t;
-
-int main(int argc, char * const argv[]) {
- if (argc != 3) {
- std::cerr << "Usage: " << argv[0]
- << " path_to_file_graph max_dim \n";
- return 0;
- }
- std::string filegraph = argv[1];
- int max_dim = atoi(argv[2]);
-
- clock_t start, end;
- // Construct the Simplex Tree
- Simplex_tree<> st;
-
- start = clock();
- auto g = read_graph<Graph_t, Filtration_value, Vertex_handle>(filegraph);
- // insert the graph in the simplex tree as 1-skeleton
- st.insert_graph(g);
- end = clock();
- std::cout << "Insert the 1-skeleton in the simplex tree in "
- << static_cast<double>(end - start) / CLOCKS_PER_SEC << " s. \n";
-
- start = clock();
- // expand the 1-skeleton until dimension max_dim
- st.expansion(max_dim);
- end = clock();
- std::cout << "max_dim = " << max_dim << "\n";
- std::cout << "Expand the simplex tree in "
- << static_cast<double>(end - start) / CLOCKS_PER_SEC << " s. \n";
-
- std::cout << "Information of the Simplex Tree: " << std::endl;
- std::cout << " Number of vertices = " << st.num_vertices() << " ";
- std::cout << " Number of simplices = " << st.num_simplices() << std::endl;
- std::cout << std::endl << std::endl;
-
- std::cout << "Iterator on vertices: ";
- for (auto vertex : st.complex_vertex_range()) {
- std::cout << vertex << " ";
- }
-
- std::cout << std::endl;
-
- std::cout << std::endl << std::endl;
-
- std::cout << "Iterator on simplices: " << std::endl;
- for (auto simplex : st.complex_simplex_range()) {
- std::cout << " ";
- for (auto vertex : st.simplex_vertex_range(simplex)) {
- std::cout << vertex << " ";
- }
- std::cout << std::endl;
- }
-
- std::cout << std::endl << std::endl;
-
- std::cout << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl;
- for (auto f_simplex : st.filtration_simplex_range()) {
- std::cout << " " << "[" << st.filtration(f_simplex) << "] ";
- for (auto vertex : st.simplex_vertex_range(f_simplex)) {
- std::cout << vertex << " ";
- }
- std::cout << std::endl;
- }
-
- std::cout << std::endl << std::endl;
-
- std::cout << "Iterator on Simplices in the filtration, and their boundary simplices:" << std::endl;
- for (auto f_simplex : st.filtration_simplex_range()) {
- std::cout << " " << "[" << st.filtration(f_simplex) << "] ";
- for (auto vertex : st.simplex_vertex_range(f_simplex)) {
- std::cout << vertex << " ";
- }
- std::cout << std::endl;
-
- for (auto b_simplex : st.boundary_simplex_range(f_simplex)) {
- std::cout << " " << "[" << st.filtration(b_simplex) << "] ";
- for (auto vertex : st.simplex_vertex_range(b_simplex)) {
- std::cout << vertex << " ";
- }
- std::cout << std::endl;
- }
- }
- return 0;
-}
diff --git a/example/Skeleton_blocker/CMakeLists.txt b/example/Skeleton_blocker/CMakeLists.txt
deleted file mode 100644
index 0e5d2f11..00000000
--- a/example/Skeleton_blocker/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-project(Skeleton_blocker_examples)
-
-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)
-
-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>)
-
-install(TARGETS Skeleton_blocker_example_from_simplices DESTINATION bin)
-install(TARGETS Skeleton_blocker_example_iteration DESTINATION bin)
-install(TARGETS Skeleton_blocker_example_link DESTINATION bin)
diff --git a/example/Skeleton_blocker/Skeleton_blocker_from_simplices.cpp b/example/Skeleton_blocker/Skeleton_blocker_from_simplices.cpp
deleted file mode 100644
index f288e39c..00000000
--- a/example/Skeleton_blocker/Skeleton_blocker_from_simplices.cpp
+++ /dev/null
@@ -1,77 +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.
- *
- * Author(s): David Salinas
- *
- * Copyright (C) 2014 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/Skeleton_blocker.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string>
-#include <fstream>
-#include <sstream>
-#include <vector>
-
-typedef Gudhi::skeleton_blocker::Skeleton_blocker_simple_traits Traits;
-typedef Gudhi::skeleton_blocker::Skeleton_blocker_complex<Traits> Complex;
-typedef Complex::Vertex_handle Vertex_handle;
-typedef Complex::Simplex Simplex;
-
-int main(int argc, char *argv[]) {
- std::vector<Simplex> simplices;
-
- // add 4 triangles of a tetrahedron 0123
- simplices.push_back(Simplex(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2)));
- simplices.push_back(Simplex(Vertex_handle(1), Vertex_handle(2), Vertex_handle(3)));
- simplices.push_back(Simplex(Vertex_handle(3), Vertex_handle(0), Vertex_handle(2)));
- simplices.push_back(Simplex(Vertex_handle(3), Vertex_handle(0), Vertex_handle(1)));
-
- // get complex from top faces
- Complex complex(Gudhi::skeleton_blocker::make_complex_from_top_faces<Complex>(simplices.begin(), simplices.end()));
-
-
- std::cout << "Simplices:" << std::endl;
- for (const Simplex & s : complex.complex_simplex_range())
- std::cout << s << " ";
- std::cout << std::endl;
-
- // One blocker as simplex 0123 is not in the complex but all its proper faces are.
- std::cout << "Blockers: " << complex.blockers_to_string() << std::endl;
-
- // now build a complex from its full list of simplices
- simplices.clear();
- simplices.push_back(Simplex(Vertex_handle(0)));
- simplices.push_back(Simplex(Vertex_handle(1)));
- simplices.push_back(Simplex(Vertex_handle(2)));
- simplices.push_back(Simplex(Vertex_handle(0), Vertex_handle(1)));
- simplices.push_back(Simplex(Vertex_handle(1), Vertex_handle(2)));
- simplices.push_back(Simplex(Vertex_handle(2), Vertex_handle(0)));
- complex = Complex(simplices.begin(), simplices.end());
-
- std::cout << "Simplices:" << std::endl;
- for (const Simplex & s : complex.complex_simplex_range())
- std::cout << s << " ";
- std::cout << std::endl;
-
- // One blocker as simplex 012 is not in the complex but all its proper faces are.
- std::cout << "Blockers: " << complex.blockers_to_string() << std::endl;
-
- return EXIT_SUCCESS;
-}
diff --git a/example/Skeleton_blocker/Skeleton_blocker_iteration.cpp b/example/Skeleton_blocker/Skeleton_blocker_iteration.cpp
deleted file mode 100644
index 4d008450..00000000
--- a/example/Skeleton_blocker/Skeleton_blocker_iteration.cpp
+++ /dev/null
@@ -1,85 +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.
- *
- * Author(s): David Salinas
- *
- * Copyright (C) 2014 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/Skeleton_blocker.h>
-#include <gudhi/Clock.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string>
-#include <fstream>
-#include <sstream>
-
-typedef Gudhi::skeleton_blocker::Skeleton_blocker_simple_traits Traits;
-typedef Gudhi::skeleton_blocker::Skeleton_blocker_complex<Traits> Complex;
-typedef Complex::Vertex_handle Vertex_handle;
-typedef Complex::Simplex Simplex;
-
-Complex build_complete_complex(int n) {
- // build a full complex with n vertices and 2^n-1 simplices
- Complex complex;
- for (int i = 0; i < n; i++)
- complex.add_vertex();
- for (int i = 0; i < n; i++)
- for (int j = 0; j < i; j++)
- complex.add_edge_without_blockers(Vertex_handle(i), Vertex_handle(j));
- return complex;
-}
-
-int main(int argc, char *argv[]) {
- Gudhi::Clock skbl_chrono("Time to build the complete complex, enumerate simplices and Euler Characteristic");
- const int n = 15;
-
- // build a full complex with n vertices and 2^n-1 simplices
- Complex complex(build_complete_complex(n));
-
- // this is just to illustrate iterators, to count number of vertices
- // or edges, complex.num_vertices() and complex.num_edges() are
- // more appropriated!
- unsigned num_vertices = 0;
- for (auto v : complex.vertex_range()) {
- std::cout << "Vertex " << v << std::endl;
- ++num_vertices;
- }
-
- // such loop can also be done directly with distance as iterators are STL compliant
- auto edges = complex.edge_range();
- unsigned num_edges = std::distance(edges.begin(), edges.end());
-
- unsigned euler = 0;
- unsigned num_simplices = 0;
- // we use a reference to a simplex instead of a copy
- // value here because a simplex is a set of integers
- // and copying it cost time
- for (const Simplex & s : complex.complex_simplex_range()) {
- ++num_simplices;
- if (s.dimension() % 2 == 0)
- euler += 1;
- else
- euler -= 1;
- }
- std::cout << "Saw " << num_vertices << " vertices, " << num_edges << " edges and " << num_simplices << " simplices"
- << std::endl;
- std::cout << "The Euler Characteristic is " << euler << std::endl;
- std::cout << skbl_chrono;
- return EXIT_SUCCESS;
-}
diff --git a/example/Skeleton_blocker/Skeleton_blocker_link.cpp b/example/Skeleton_blocker/Skeleton_blocker_link.cpp
deleted file mode 100644
index 2ec72128..00000000
--- a/example/Skeleton_blocker/Skeleton_blocker_link.cpp
+++ /dev/null
@@ -1,69 +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.
- *
- * Author(s): David Salinas
- *
- * Copyright (C) 2014 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/Skeleton_blocker.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string>
-#include <fstream>
-#include <sstream>
-
-typedef Gudhi::skeleton_blocker::Skeleton_blocker_simple_traits Traits;
-typedef Gudhi::skeleton_blocker::Skeleton_blocker_complex<Traits> Complex;
-typedef Complex::Vertex_handle Vertex_handle;
-typedef Complex::Root_vertex_handle Root_vertex_handle;
-typedef Complex::Simplex Simplex;
-
-int main(int argc, char *argv[]) {
- // build a full complex with 4 vertices and 2^4-1 simplices
-
- // Create a complex with four vertices (0,1,2,3)
- Complex complex;
-
- // Add a tetrahedron to this complex
- Simplex tetrahedron(Vertex_handle(0), Vertex_handle(1), Vertex_handle(2), Vertex_handle(3));
- complex.add_simplex(tetrahedron);
-
- std::cout << "complex:" << complex.to_string() << std::endl;
-
- // build the link of vertex 1, eg a triangle {0,2,3}
- auto link = complex.link(Vertex_handle(1));
- std::cout << "link:" << link.to_string() << std::endl;
-
- // Internally link is a subcomplex of 'complex' and its vertices are stored in a vector.
- // They can be accessed via Vertex_handle(x) where x is an index of the vector.
- // In that example, link has three vertices and thus it contains only
- // Vertex_handle(0),Vertex_handle(1) and Vertex_handle(2) are).
- for (int i = 0; i < 5; ++i)
- std::cout << "link.contains_vertex(Vertex_handle(" << i << ")):" << link.contains_vertex(Vertex_handle(i)) <<
- std::endl;
- std::cout << std::endl;
-
- // To access to the initial vertices eg (0,1,2,3,4), Root_vertex_handle must be used.
- // For instance, to test if the link contains the vertex that was labeled i:
- for (int i = 0; i < 5; ++i)
- std::cout << "link.contains_vertex(Root_vertex_handle(" << i << ")):" <<
- link.contains_vertex(Root_vertex_handle(i)) << std::endl;
-
- return EXIT_SUCCESS;
-}
diff --git a/example/Spatial_searching/CMakeLists.txt b/example/Spatial_searching/CMakeLists.txt
deleted file mode 100644
index 0f799987..00000000
--- a/example/Spatial_searching/CMakeLists.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-project(Spatial_searching_examples)
-
-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>)
- install(TARGETS Spatial_searching_example_spatial_searching DESTINATION bin)
-endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
diff --git a/example/Spatial_searching/example_spatial_searching.cpp b/example/Spatial_searching/example_spatial_searching.cpp
deleted file mode 100644
index 034ad24a..00000000
--- a/example/Spatial_searching/example_spatial_searching.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-#include <gudhi/Kd_tree_search.h>
-
-#include <CGAL/Epick_d.h>
-#include <CGAL/Random.h>
-
-#include <vector>
-
-namespace gss = Gudhi::spatial_searching;
-
-int main(void) {
- typedef CGAL::Epick_d<CGAL::Dimension_tag<4> > K;
- typedef typename K::Point_d Point;
- typedef std::vector<Point> Points;
-
- typedef gss::Kd_tree_search<K, Points> Points_ds;
-
- CGAL::Random rd;
-
- Points points;
- for (int i = 0; i < 500; ++i)
- points.push_back(Point(rd.get_double(-1., 1), rd.get_double(-1., 1), rd.get_double(-1., 1), rd.get_double(-1., 1)));
-
- Points_ds points_ds(points);
-
- // 10-nearest neighbor query
- std::cout << "10 nearest neighbors from points[20]:\n";
- auto knn_range = points_ds.k_nearest_neighbors(points[20], 10, true);
- for (auto const& nghb : knn_range)
- std::cout << nghb.first << " (sq. dist. = " << nghb.second << ")\n";
-
- // Incremental nearest neighbor query
- std::cout << "Incremental nearest neighbors:\n";
- auto inn_range = points_ds.incremental_nearest_neighbors(points[45]);
- // Get the neighbors in distance order until we hit the first point
- for (auto ins_iterator = inn_range.begin(); ins_iterator->first != 0; ++ins_iterator)
- std::cout << ins_iterator->first << " (sq. dist. = " << ins_iterator->second << ")\n";
-
- // 10-furthest neighbor query
- std::cout << "10 furthest neighbors from points[20]:\n";
- auto kfn_range = points_ds.k_furthest_neighbors(points[20], 10, true);
- for (auto const& nghb : kfn_range)
- std::cout << nghb.first << " (sq. dist. = " << nghb.second << ")\n";
-
- // Incremental furthest neighbor query
- std::cout << "Incremental furthest neighbors:\n";
- auto ifn_range = points_ds.incremental_furthest_neighbors(points[45]);
- // Get the neighbors in distance reverse order until we hit the first point
- for (auto ifs_iterator = ifn_range.begin(); ifs_iterator->first != 0; ++ifs_iterator)
- std::cout << ifs_iterator->first << " (sq. dist. = " << ifs_iterator->second << ")\n";
-
- // All-near-neighbors search
- std::cout << "All-near-neighbors search:\n";
- std::vector<std::size_t> rs_result;
- points_ds.all_near_neighbors(points[45], 0.5, std::back_inserter(rs_result));
- K k;
- for (auto const& p_idx : rs_result)
- std::cout << p_idx << " (sq. dist. = " << k.squared_distance_d_object()(points[p_idx], points[45]) << ")\n";
-
- return 0;
-}
diff --git a/example/Subsampling/CMakeLists.txt b/example/Subsampling/CMakeLists.txt
deleted file mode 100644
index f26d107f..00000000
--- a/example/Subsampling/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-project(Subsampling_examples)
-
-if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
- add_executable(Subsampling_example_pick_n_random_points example_pick_n_random_points.cpp)
- add_executable(Subsampling_example_choose_n_farthest_points example_choose_n_farthest_points.cpp)
- add_executable(Subsampling_example_custom_kernel example_custom_kernel.cpp)
- add_executable(Subsampling_example_sparsify_point_set example_sparsify_point_set.cpp)
- target_link_libraries(Subsampling_example_sparsify_point_set ${CGAL_LIBRARY})
-
- 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>)
-
- install(TARGETS Subsampling_example_pick_n_random_points DESTINATION bin)
- install(TARGETS Subsampling_example_choose_n_farthest_points DESTINATION bin)
- install(TARGETS Subsampling_example_custom_kernel DESTINATION bin)
- install(TARGETS Subsampling_example_sparsify_point_set DESTINATION bin)
-
-endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
diff --git a/example/Subsampling/example_choose_n_farthest_points.cpp b/example/Subsampling/example_choose_n_farthest_points.cpp
deleted file mode 100644
index ebf631fc..00000000
--- a/example/Subsampling/example_choose_n_farthest_points.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <gudhi/choose_n_farthest_points.h>
-
-#include <CGAL/Epick_d.h>
-#include <CGAL/Random.h>
-
-#include <vector>
-#include <iterator>
-
-int main(void) {
- typedef CGAL::Epick_d<CGAL::Dimension_tag<4> > K;
- typedef typename K::Point_d Point_d;
-
- CGAL::Random rd;
-
- std::vector<Point_d> points;
- for (int i = 0; i < 500; ++i)
- points.push_back(Point_d(rd.get_double(-1., 1), rd.get_double(-1., 1),
- rd.get_double(-1., 1), rd.get_double(-1., 1)));
-
- K k;
- std::vector<Point_d> 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";
-
- return 0;
-}
diff --git a/example/Subsampling/example_custom_kernel.cpp b/example/Subsampling/example_custom_kernel.cpp
deleted file mode 100644
index 2d42bdde..00000000
--- a/example/Subsampling/example_custom_kernel.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-#include <gudhi/choose_n_farthest_points.h>
-
-#include <CGAL/Epick_d.h>
-#include <CGAL/Random.h>
-
-#include <vector>
-#include <iterator>
-
-
-/* The class Kernel contains a distance function defined on the set of points {0, 1, 2, 3}
- * and computes a distance according to the matrix:
- * 0 1 2 4
- * 1 0 4 2
- * 2 4 0 1
- * 4 2 1 0
- */
-class Kernel {
- public:
- typedef double FT;
- typedef unsigned Point_d;
-
- // Class Squared_distance_d
- class Squared_distance_d {
- private:
- std::vector<std::vector<FT>> matrix_;
-
- public:
- Squared_distance_d() {
- matrix_.push_back(std::vector<FT>({0, 1, 2, 4}));
- matrix_.push_back(std::vector<FT>({1, 0, 4, 2}));
- matrix_.push_back(std::vector<FT>({2, 4, 0, 1}));
- matrix_.push_back(std::vector<FT>({4, 2, 1, 0}));
- }
-
- FT operator()(Point_d p1, Point_d p2) {
- return matrix_[p1][p2];
- }
- };
-
- // Constructor
- Kernel() {}
-
- // Object of type Squared_distance_d
- Squared_distance_d squared_distance_d_object() const {
- return Squared_distance_d();
- }
-};
-
-int main(void) {
- typedef Kernel K;
- typedef typename K::Point_d Point_d;
-
- K k;
- std::vector<Point_d> points = {0, 1, 2, 3};
- std::vector<Point_d> 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";
-
- return 0;
-}
diff --git a/example/Subsampling/example_pick_n_random_points.cpp b/example/Subsampling/example_pick_n_random_points.cpp
deleted file mode 100644
index 1e38e405..00000000
--- a/example/Subsampling/example_pick_n_random_points.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <gudhi/pick_n_random_points.h>
-
-#include <CGAL/Epick_d.h>
-#include <CGAL/Random.h>
-
-#include <vector>
-#include <iterator>
-
-int main(void) {
- typedef CGAL::Epick_d<CGAL::Dimension_tag<4> > K;
- typedef typename K::Point_d Point_d;
-
- CGAL::Random rd;
-
- std::vector<Point_d> points;
- for (int i = 0; i < 500; ++i)
- points.push_back(Point_d(rd.get_double(-1., 1), rd.get_double(-1., 1),
- rd.get_double(-1., 1), rd.get_double(-1., 1)));
-
- K k;
- std::vector<Point_d> results;
- Gudhi::subsampling::pick_n_random_points(points, 100, std::back_inserter(results));
- std::cout << "Before sparsification: " << points.size() << " points.\n";
- std::cout << "After sparsification: " << results.size() << " points.\n";
-
- return 0;
-}
diff --git a/example/Subsampling/example_sparsify_point_set.cpp b/example/Subsampling/example_sparsify_point_set.cpp
deleted file mode 100644
index b35a18d9..00000000
--- a/example/Subsampling/example_sparsify_point_set.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <gudhi/sparsify_point_set.h>
-
-#include <CGAL/Epick_d.h>
-#include <CGAL/Random.h>
-
-#include <vector>
-#include <iterator>
-
-int main(void) {
- typedef CGAL::Epick_d<CGAL::Dimension_tag<4> > K;
- typedef typename K::Point_d Point_d;
-
- CGAL::Random rd;
-
- std::vector<Point_d> points;
- for (int i = 0; i < 500; ++i)
- points.push_back(Point_d(rd.get_double(-1., 1), rd.get_double(-1., 1),
- rd.get_double(-1., 1), rd.get_double(-1., 1)));
-
- K k;
- std::vector<Point_d> results;
- Gudhi::subsampling::sparsify_point_set(k, points, 0.4, std::back_inserter(results));
- std::cout << "Before sparsification: " << points.size() << " points.\n";
- std::cout << "After sparsification: " << results.size() << " points.\n";
-
- return 0;
-}
diff --git a/example/Tangential_complex/CMakeLists.txt b/example/Tangential_complex/CMakeLists.txt
deleted file mode 100644
index af0dac51..00000000
--- a/example/Tangential_complex/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-project(Tangential_complex_examples)
-
-if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
- add_executable( Tangential_complex_example_basic example_basic.cpp )
- target_link_libraries(Tangential_complex_example_basic ${CGAL_LIBRARY})
- add_executable( Tangential_complex_example_with_perturb example_with_perturb.cpp )
- target_link_libraries(Tangential_complex_example_with_perturb ${CGAL_LIBRARY})
- if (TBB_FOUND)
- target_link_libraries(Tangential_complex_example_basic ${TBB_LIBRARIES})
- target_link_libraries(Tangential_complex_example_with_perturb ${TBB_LIBRARIES})
- endif(TBB_FOUND)
-
- 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>)
-
- install(TARGETS Tangential_complex_example_basic DESTINATION bin)
- install(TARGETS Tangential_complex_example_with_perturb DESTINATION bin)
-endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
diff --git a/example/Tangential_complex/example_basic.cpp b/example/Tangential_complex/example_basic.cpp
deleted file mode 100644
index 4f2b859e..00000000
--- a/example/Tangential_complex/example_basic.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <gudhi/Tangential_complex.h>
-#include <gudhi/sparsify_point_set.h>
-
-#include <CGAL/Epick_d.h>
-#include <CGAL/Random.h>
-
-#include <array>
-#include <vector>
-
-namespace tc = Gudhi::tangential_complex;
-
-typedef CGAL::Epick_d<CGAL::Dynamic_dimension_tag> Kernel;
-typedef Kernel::FT FT;
-typedef Kernel::Point_d Point;
-typedef Kernel::Vector_d Vector;
-typedef tc::Tangential_complex<
-Kernel, CGAL::Dynamic_dimension_tag,
-CGAL::Parallel_tag> TC;
-
-int main(void) {
- const int INTRINSIC_DIM = 2;
- const int AMBIENT_DIM = 3;
- const int NUM_POINTS = 1000;
-
- Kernel k;
-
- // Generate points on a 2-sphere
- CGAL::Random_points_on_sphere_d<Point> generator(AMBIENT_DIM, 3.);
- std::vector<Point> points;
- points.reserve(NUM_POINTS);
- for (int i = 0; i < NUM_POINTS; ++i)
- points.push_back(*generator++);
-
- // Compute the TC
- TC tc(points, INTRINSIC_DIM, k);
- tc.compute_tangential_complex();
-
- // Export the TC into a Simplex_tree
- Gudhi::Simplex_tree<> stree;
- tc.create_complex(stree);
-
- // Display stats about inconsistencies
- tc.number_of_inconsistent_simplices(true); // verbose
-
- return 0;
-}
diff --git a/example/Tangential_complex/example_with_perturb.cpp b/example/Tangential_complex/example_with_perturb.cpp
deleted file mode 100644
index d0d877ea..00000000
--- a/example/Tangential_complex/example_with_perturb.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-#include <gudhi/Tangential_complex.h>
-#include <gudhi/sparsify_point_set.h>
-
-#include <CGAL/Epick_d.h>
-#include <CGAL/Random.h>
-
-#include <array>
-#include <vector>
-
-namespace subsampl = Gudhi::subsampling;
-namespace tc = Gudhi::tangential_complex;
-
-typedef CGAL::Epick_d<CGAL::Dimension_tag < 3 >> Kernel;
-typedef Kernel::FT FT;
-typedef Kernel::Point_d Point;
-typedef Kernel::Vector_d Vector;
-typedef tc::Tangential_complex<
-Kernel, CGAL::Dimension_tag<2>,
-CGAL::Parallel_tag> TC;
-
-int main(void) {
- const int INTRINSIC_DIM = 2;
- const int AMBIENT_DIM = 3;
- const int NUM_POINTS = 50;
-
- Kernel k;
-
- // Generate points on a 2-sphere
- CGAL::Random_points_on_sphere_d<Point> generator(AMBIENT_DIM, 3.);
- std::vector<Point> points;
- points.reserve(NUM_POINTS);
- for (int i = 0; i < NUM_POINTS; ++i)
- points.push_back(*generator++);
-
- // Sparsify the point set
- std::vector<Point> sparsified_points;
- subsampl::sparsify_point_set(k, points, 0.1 * 0.1,
- std::back_inserter(sparsified_points));
- sparsified_points.swap(points);
-
- // Compute the TC
- TC tc(points, INTRINSIC_DIM, k);
- tc.compute_tangential_complex();
-
- // Try to fix inconsistencies. Give it 10 seconds to succeed
- tc.fix_inconsistencies_using_perturbation(0.05, 10);
-
- // Export the TC into a Simplex_tree
- Gudhi::Simplex_tree<> stree;
- tc.create_complex(stree);
-
- return 0;
-}
diff --git a/example/Witness_complex/CMakeLists.txt b/example/Witness_complex/CMakeLists.txt
deleted file mode 100644
index 3d838c0d..00000000
--- a/example/Witness_complex/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-project(Witness_complex_examples)
-
-add_executable ( Witness_complex_example_nearest_landmark_table example_nearest_landmark_table.cpp )
-if (TBB_FOUND)
- target_link_libraries(Witness_complex_example_nearest_landmark_table ${TBB_LIBRARIES})
-endif()
-add_test(NAME Witness_complex_example_nearest_landmark_table
- COMMAND $<TARGET_FILE:Witness_complex_example_nearest_landmark_table>)
-
-install(TARGETS Witness_complex_example_nearest_landmark_table DESTINATION bin)
-
-# CGAL and Eigen3 are required for Euclidean version of Witness
-if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0)
- add_executable( Witness_complex_example_off example_witness_complex_off.cpp )
- add_executable ( Witness_complex_example_sphere example_witness_complex_sphere.cpp )
-
- add_executable( Witness_complex_example_strong_off example_strong_witness_complex_off.cpp )
- target_link_libraries(Witness_complex_example_strong_off)
-
- 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_test_sphere_10
- COMMAND $<TARGET_FILE:Witness_complex_example_sphere> "10")
- 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")
-
- install(TARGETS Witness_complex_example_off DESTINATION bin)
- install(TARGETS Witness_complex_example_sphere DESTINATION bin)
- install(TARGETS Witness_complex_example_strong_off DESTINATION bin)
-
-
-endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0)
diff --git a/example/Witness_complex/example_nearest_landmark_table.cpp b/example/Witness_complex/example_nearest_landmark_table.cpp
deleted file mode 100644
index acaf7c54..00000000
--- a/example/Witness_complex/example_nearest_landmark_table.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-#define BOOST_PARAMETER_MAX_ARITY 12
-
-#include <gudhi/Simplex_tree.h>
-#include <gudhi/Witness_complex.h>
-#include <gudhi/Persistent_cohomology.h>
-
-#include <iostream>
-#include <fstream>
-#include <utility>
-#include <string>
-#include <vector>
-
-int main(int argc, char * const argv[]) {
- using Nearest_landmark_range = std::vector<std::pair<std::size_t, double>>;
- using Nearest_landmark_table = std::vector<Nearest_landmark_range>;
- using Witness_complex = Gudhi::witness_complex::Witness_complex<Nearest_landmark_table>;
- using Simplex_tree = Gudhi::Simplex_tree<>;
- using Field_Zp = Gudhi::persistent_cohomology::Field_Zp;
- using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomology<Simplex_tree, Field_Zp>;
-
- Simplex_tree simplex_tree;
- Nearest_landmark_table nlt;
-
- // Example contains 5 witnesses and 5 landmarks
- Nearest_landmark_range w0 = {std::make_pair(0, 0), std::make_pair(1, 1), std::make_pair(2, 2),
- std::make_pair(3, 3), std::make_pair(4, 4)}; nlt.push_back(w0);
- Nearest_landmark_range w1 = {std::make_pair(1, 0), std::make_pair(2, 1), std::make_pair(3, 2),
- std::make_pair(4, 3), std::make_pair(0, 4)}; nlt.push_back(w1);
- Nearest_landmark_range w2 = {std::make_pair(2, 0), std::make_pair(3, 1), std::make_pair(4, 2),
- std::make_pair(0, 3), std::make_pair(1, 4)}; nlt.push_back(w2);
- Nearest_landmark_range w3 = {std::make_pair(3, 0), std::make_pair(4, 1), std::make_pair(0, 2),
- std::make_pair(1, 3), std::make_pair(2, 4)}; nlt.push_back(w3);
- Nearest_landmark_range w4 = {std::make_pair(4, 0), std::make_pair(0, 1), std::make_pair(1, 2),
- std::make_pair(2, 3), std::make_pair(3, 4)}; nlt.push_back(w4);
-
- Witness_complex witness_complex(nlt);
- witness_complex.create_complex(simplex_tree, 4.1);
-
- std::cout << "Number of simplices: " << simplex_tree.num_simplices() << std::endl;
-
- Persistent_cohomology pcoh(simplex_tree);
- // initializes the coefficient field for homology
- pcoh.init_coefficients(11);
-
- pcoh.compute_persistent_cohomology(-0.1);
- pcoh.output_diagram();
-}
diff --git a/example/Witness_complex/example_strong_witness_complex_off.cpp b/example/Witness_complex/example_strong_witness_complex_off.cpp
deleted file mode 100644
index 19f73836..00000000
--- a/example/Witness_complex/example_strong_witness_complex_off.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <gudhi/Simplex_tree.h>
-#include <gudhi/Euclidean_strong_witness_complex.h>
-#include <gudhi/pick_n_random_points.h>
-#include <gudhi/choose_n_farthest_points.h>
-#include <gudhi/Points_off_io.h>
-
-#include <CGAL/Epick_d.h>
-
-#include <iostream>
-#include <fstream>
-#include <ctime>
-#include <string>
-#include <vector>
-
-using K = CGAL::Epick_d<CGAL::Dynamic_dimension_tag>;
-using Point_d = typename K::Point_d;
-using Witness_complex = Gudhi::witness_complex::Euclidean_strong_witness_complex<K>;
-using Point_vector = std::vector<Point_d>;
-
-int main(int argc, char* const argv[]) {
- if (argc != 5) {
- std::cerr << "Usage: " << argv[0] << " path_to_point_file number_of_landmarks max_squared_alpha limit_dimension\n";
- return 0;
- }
-
- std::string file_name = argv[1];
- int nbL = atoi(argv[2]), lim_dim = atoi(argv[4]);
- double alpha2 = atof(argv[3]);
- clock_t start, end;
- Gudhi::Simplex_tree<> simplex_tree;
-
- // Read the point file
- Point_vector point_vector, landmarks;
- Gudhi::Points_off_reader<Point_d> off_reader(file_name);
- if (!off_reader.is_valid()) {
- std::cerr << "Strong witness complex - Unable to read file " << file_name << "\n";
- exit(-1); // ----- >>
- }
- point_vector = Point_vector(off_reader.get_point_cloud());
-
- std::cout << "Successfully read " << point_vector.size() << " points.\n";
- std::cout << "Ambient dimension is " << point_vector[0].dimension() << ".\n";
-
- // Choose landmarks (decomment one of the following two lines)
- // Gudhi::subsampling::pick_n_random_points(point_vector, nbL, std::back_inserter(landmarks));
- Gudhi::subsampling::choose_n_farthest_points(K(), point_vector, nbL, Gudhi::subsampling::random_starting_point,
- std::back_inserter(landmarks));
-
- // Compute witness complex
- start = clock();
- Witness_complex witness_complex(landmarks, point_vector);
-
- witness_complex.create_complex(simplex_tree, alpha2, lim_dim);
- end = clock();
- std::cout << "Strong witness complex took " << static_cast<double>(end - start) / CLOCKS_PER_SEC << " s. \n";
- std::cout << "Number of simplices is: " << simplex_tree.num_simplices() << "\n";
-}
diff --git a/example/Witness_complex/example_witness_complex_off.cpp b/example/Witness_complex/example_witness_complex_off.cpp
deleted file mode 100644
index be11c955..00000000
--- a/example/Witness_complex/example_witness_complex_off.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <gudhi/Simplex_tree.h>
-#include <gudhi/Euclidean_witness_complex.h>
-#include <gudhi/pick_n_random_points.h>
-#include <gudhi/choose_n_farthest_points.h>
-#include <gudhi/Points_off_io.h>
-
-#include <CGAL/Epick_d.h>
-
-#include <iostream>
-#include <fstream>
-#include <ctime>
-#include <string>
-#include <vector>
-
-using K = CGAL::Epick_d<CGAL::Dynamic_dimension_tag>;
-using Point_d = K::Point_d;
-using Witness_complex = Gudhi::witness_complex::Euclidean_witness_complex<K>;
-using Point_vector = std::vector< Point_d >;
-
-int main(int argc, char * const argv[]) {
- if (argc != 5) {
- std::cerr << "Usage: " << argv[0]
- << " path_to_point_file number_of_landmarks max_squared_alpha limit_dimension\n";
- return 0;
- }
-
- std::string file_name = argv[1];
- int nbL = atoi(argv[2]), lim_dim = atoi(argv[4]);
- double alpha2 = atof(argv[3]);
- clock_t start, end;
- Gudhi::Simplex_tree<> simplex_tree;
-
- // Read the point file
- Point_vector point_vector, landmarks;
- Gudhi::Points_off_reader<Point_d> off_reader(file_name);
- if (!off_reader.is_valid()) {
- std::cerr << "Witness complex - Unable to read file " << file_name << "\n";
- exit(-1); // ----- >>
- }
- point_vector = Point_vector(off_reader.get_point_cloud());
-
- std::cout << "Successfully read " << point_vector.size() << " points.\n";
- std::cout << "Ambient dimension is " << point_vector[0].dimension() << ".\n";
-
- // Choose landmarks (decomment one of the following two lines)
- // Gudhi::subsampling::pick_n_random_points(point_vector, nbL, std::back_inserter(landmarks));
- Gudhi::subsampling::choose_n_farthest_points(K(), point_vector, nbL, Gudhi::subsampling::random_starting_point, std::back_inserter(landmarks));
-
- // Compute witness complex
- start = clock();
- Witness_complex witness_complex(landmarks,
- point_vector);
-
- witness_complex.create_complex(simplex_tree, alpha2, lim_dim);
- end = clock();
- std::cout << "Witness complex took "
- << static_cast<double>(end - start) / CLOCKS_PER_SEC << " s. \n";
- std::cout << "Number of simplices is: " << simplex_tree.num_simplices() << "\n";
-}
diff --git a/example/Witness_complex/example_witness_complex_sphere.cpp b/example/Witness_complex/example_witness_complex_sphere.cpp
deleted file mode 100644
index 9e3c972d..00000000
--- a/example/Witness_complex/example_witness_complex_sphere.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-#define BOOST_PARAMETER_MAX_ARITY 12
-
-#include <gudhi/Simplex_tree.h>
-#include <gudhi/Euclidean_witness_complex.h>
-#include <gudhi/pick_n_random_points.h>
-#include <gudhi/choose_n_farthest_points.h>
-#include <gudhi/reader_utils.h>
-
-#include <CGAL/Epick_d.h>
-
-#include <iostream>
-#include <fstream>
-#include <ctime>
-#include <utility>
-#include <string>
-#include <vector>
-
-#include "generators.h"
-
-/** Write a gnuplot readable file.
- * Data range is a random access range of pairs (arg, value)
- */
-template <typename Data_range>
-void write_data(Data_range& data, std::string filename) {
- std::ofstream ofs(filename, std::ofstream::out);
- for (auto entry : data) ofs << entry.first << ", " << entry.second << "\n";
- ofs.close();
-}
-
-int main(int argc, char* const argv[]) {
- using Kernel = CGAL::Epick_d<CGAL::Dynamic_dimension_tag>;
- using Witness_complex = Gudhi::witness_complex::Euclidean_witness_complex<Kernel>;
-
- if (argc != 2) {
- std::cerr << "Usage: " << argv[0] << " number_of_landmarks \n";
- return 0;
- }
-
- int number_of_landmarks = atoi(argv[1]);
-
- std::vector<std::pair<int, double> > l_time;
-
- // Generate points
- for (int nbP = 500; nbP < 10000; nbP += 500) {
- clock_t start, end;
- // Construct the Simplex Tree
- Gudhi::Simplex_tree<> simplex_tree;
- Point_Vector point_vector, landmarks;
- generate_points_sphere(point_vector, nbP, 4);
- std::cout << "Successfully generated " << point_vector.size() << " points.\n";
- std::cout << "Ambient dimension is " << point_vector[0].size() << ".\n";
-
- // Choose landmarks
- start = clock();
- // Gudhi::subsampling::pick_n_random_points(point_vector, number_of_landmarks, std::back_inserter(landmarks));
- Gudhi::subsampling::choose_n_farthest_points(K(), point_vector, number_of_landmarks,
- Gudhi::subsampling::random_starting_point,
- std::back_inserter(landmarks));
-
- // Compute witness complex
- Witness_complex witness_complex(landmarks, point_vector);
- witness_complex.create_complex(simplex_tree, 0);
- end = clock();
- double time = static_cast<double>(end - start) / CLOCKS_PER_SEC;
- std::cout << "Witness complex for " << number_of_landmarks << " landmarks took " << time << " s. \n";
- std::cout << "Number of simplices is: " << simplex_tree.num_simplices() << "\n";
- l_time.push_back(std::make_pair(nbP, time));
- }
- write_data(l_time, "w_time.dat");
-}
diff --git a/example/Witness_complex/generators.h b/example/Witness_complex/generators.h
deleted file mode 100644
index 4b755daa..00000000
--- a/example/Witness_complex/generators.h
+++ /dev/null
@@ -1,166 +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.
- *
- * Author(s): Siargey Kachanovich
- *
- * 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/>.
- */
-
-#ifndef GENERATORS_H_
-#define GENERATORS_H_
-
-#include <CGAL/Epick_d.h>
-#include <CGAL/point_generators_d.h>
-#include <CGAL/Random.h>
-
-#include <fstream>
-#include <string>
-#include <vector>
-#include <cmath>
-
-using K = CGAL::Epick_d<CGAL::Dynamic_dimension_tag>;
-using FT = K::FT;
-using Point_d = K::Point_d;
-using Point_Vector = std::vector<Point_d>;
-using Random_cube_iterator = CGAL::Random_points_in_cube_d<Point_d>;
-using Random_point_iterator = CGAL::Random_points_in_ball_d<Point_d>;
-
-/**
- * \brief Rock age method of reading off file
- *
- */
-inline void
-off_reader_cust(std::string file_name, std::vector<Point_d> & points) {
- std::ifstream in_file(file_name.c_str(), std::ios::in);
- if (!in_file.is_open()) {
- std::cerr << "Unable to open file " << file_name << std::endl;
- return;
- }
- std::string line;
- double x;
- // Line OFF. No need in it
- if (!getline(in_file, line)) {
- std::cerr << "No line OFF\n";
- return;
- }
- // Line with 3 numbers. No need
- if (!getline(in_file, line)) {
- std::cerr << "No line with 3 numbers\n";
- return;
- }
- // Reading points
- while (getline(in_file, line)) {
- std::vector< double > point;
- std::istringstream iss(line);
- while (iss >> x) {
- point.push_back(x);
- }
- points.push_back(Point_d(point));
- }
- in_file.close();
-}
-
-/**
- * \brief Customized version of read_points
- * which takes into account a possible nbP first line
- *
- */
-inline void
-read_points_cust(std::string file_name, Point_Vector & points) {
- std::ifstream in_file(file_name.c_str(), std::ios::in);
- if (!in_file.is_open()) {
- std::cerr << "Unable to open file " << file_name << std::endl;
- return;
- }
- std::string line;
- double x;
- while (getline(in_file, line)) {
- std::vector< double > point;
- std::istringstream iss(line);
- while (iss >> x) {
- point.push_back(x);
- }
- Point_d p(point.begin(), point.end());
- if (point.size() != 1)
- points.push_back(p);
- }
- in_file.close();
-}
-
-/** \brief Generate points on a grid in a cube of side 2
- * having {+-1}^D as vertices and insert them in W.
- * The grid has "width" points on each side.
- * If torus is true then it is supposed that the cube represents
- * a flat torus, hence the opposite borders are associated.
- * The points on border in this case are not placed twice.
- */
-void generate_points_grid(Point_Vector& W, int width, int D, bool torus) {
- int nb_points = 1;
- for (int i = 0; i < D; ++i)
- nb_points *= width;
- for (int i = 0; i < nb_points; ++i) {
- std::vector<double> point;
- int cell_i = i;
- for (int l = 0; l < D; ++l) {
- if (torus)
- point.push_back(-1 + (2.0 / (width - 1))*(cell_i % width));
- else
- point.push_back(-1 + (2.0 / width)*(cell_i % width));
- // attention: the bottom and the right are covered too!
- cell_i /= width;
- }
- W.push_back(point);
- }
-}
-
-/** \brief Generate nbP points uniformly in a cube of side 2
- * having {+-1}^dim as its vertices and insert them in W.
- */
-void generate_points_random_box(Point_Vector& W, int nbP, int dim) {
- Random_cube_iterator rp(dim, 1.0);
- for (int i = 0; i < nbP; i++) {
- W.push_back(*rp++);
- }
-}
-
-/** \brief Generate nbP points uniformly on a (dim-1)-sphere
- * and insert them in W.
- */
-void generate_points_sphere(Point_Vector& W, int nbP, int dim) {
- CGAL::Random_points_on_sphere_d<Point_d> rp(dim, 1);
- for (int i = 0; i < nbP; i++)
- W.push_back(*rp++);
-}
-
-/** \brief Generate nbP points on a (flat) d-torus embedded in R^{2d}
- *
- */
-void generate_points_torus(Point_Vector& W, int nbP, int dim) {
- CGAL::Random rand;
- const double pi = std::acos(-1);
- for (int i = 0; i < nbP; i++) {
- std::vector<FT> point;
- for (int j = 0; j < dim; j++) {
- double alpha = rand.uniform_real(static_cast<double>(0), 2*pi);
- point.push_back(sin(alpha));
- point.push_back(cos(alpha));
- }
- W.push_back(Point_d(point));
- }
-}
-
-#endif // GENERATORS_H_
diff --git a/example/common/CMakeLists.txt b/example/common/CMakeLists.txt
deleted file mode 100644
index 04015cdc..00000000
--- a/example/common/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-project(Common_examples)
-
-add_executable ( vector_double_off_reader example_vector_double_points_off_reader.cpp )
-target_link_libraries(vector_double_off_reader ${CGAL_LIBRARY})
-file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
-add_test(NAME Common_example_vector_double_off_reader COMMAND $<TARGET_FILE:vector_double_off_reader>
- "alphacomplexdoc.off")
-
-install(TARGETS vector_double_off_reader DESTINATION bin)
-
-if (DIFF_PATH)
- # Do not forget to copy test results files in current binary dir
- file(COPY "vectordoubleoffreader_result.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
-
- add_test(Common_example_vector_double_off_reader_diff_files ${DIFF_PATH}
- ${CMAKE_CURRENT_BINARY_DIR}/vectordoubleoffreader_result.txt ${CMAKE_CURRENT_BINARY_DIR}/alphacomplexdoc.off.txt)
-endif()
-
-if(CGAL_FOUND)
- add_executable ( cgal_3D_off_reader example_CGAL_3D_points_off_reader.cpp )
- target_link_libraries(cgal_3D_off_reader ${CGAL_LIBRARY})
- 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")
-
- install(TARGETS cgal_3D_off_reader DESTINATION bin)
-
- # need CGAL 4.7 and 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 ${CGAL_LIBRARY})
- add_test(NAME Common_example_vector_cgal_off_reader COMMAND $<TARGET_FILE:cgal_off_reader>
- "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off")
- install(TARGETS cgal_off_reader DESTINATION bin)
- endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
-
-endif()
diff --git a/example/common/cgal3Doffreader_result.txt b/example/common/cgal3Doffreader_result.txt
deleted file mode 100644
index f992c8e3..00000000
--- a/example/common/cgal3Doffreader_result.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-Point[1] = (0.959535, -0.418347, 0.302237)
-Point[2] = (2.16795, 1.85348, -0.52312)
-Point[3] = (-2.38753, -1.50911, -0.565889)
-Point[4] = (-2.70428, -1.25688, 0.188394)
-Point[5] = (-1.22932, -1.64337, -0.998632)
-...
-Point[300] = (-0.56244, 2.6018, -0.749591)
-
diff --git a/example/common/example_CGAL_3D_points_off_reader.cpp b/example/common/example_CGAL_3D_points_off_reader.cpp
deleted file mode 100644
index 4658d8d5..00000000
--- a/example/common/example_CGAL_3D_points_off_reader.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <gudhi/Points_3D_off_io.h>
-
-#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-
-#include <iostream>
-#include <string>
-#include <vector>
-
-using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
-using Point_3 = Kernel::Point_3;
-
-void usage(char * const progName) {
- std::cerr << "Usage: " << progName << " inputFile.off" << std::endl;
- exit(-1);
-}
-
-int main(int argc, char **argv) {
- if (argc != 2) {
- std::cerr << "Error: Number of arguments (" << argc << ") is not correct" << std::endl;
- usage(argv[0]);
- }
-
- std::string off_input_file(argv[1]);
- // Read the OFF file (input file name given as parameter) and triangulate points
- Gudhi::Points_3D_off_reader<Point_3> off_reader(off_input_file);
- // Check the read operation was correct
- if (!off_reader.is_valid()) {
- std::cerr << "Unable to read file " << off_input_file << std::endl;
- usage(argv[0]);
- }
-
- // Retrieve the triangulation
- std::vector<Point_3> point_cloud = off_reader.get_point_cloud();
-
- int n {};
- for (auto point : point_cloud) {
- ++n;
- std::cout << "Point[" << n << "] = (" << point[0] << ", " << point[1] << ", " << point[2] << ")\n";
- }
- return 0;
-}
diff --git a/example/common/example_CGAL_points_off_reader.cpp b/example/common/example_CGAL_points_off_reader.cpp
deleted file mode 100644
index f45683a5..00000000
--- a/example/common/example_CGAL_points_off_reader.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <gudhi/Points_off_io.h>
-
-// For CGAL points type in dimension d
-// cf. http://doc.cgal.org/latest/Kernel_d/classCGAL_1_1Point__d.html
-#include <CGAL/Epick_d.h>
-
-#include <iostream>
-#include <string>
-#include <vector>
-
-using Kernel = CGAL::Epick_d< CGAL::Dynamic_dimension_tag >;
-using Point_d = Kernel::Point_d;
-
-void usage(char * const progName) {
- std::cerr << "Usage: " << progName << " inputFile.off" << std::endl;
- exit(-1);
-}
-
-int main(int argc, char **argv) {
- if (argc != 2) {
- std::cerr << "Error: Number of arguments (" << argc << ") is not correct" << std::endl;
- usage(argv[0]);
- }
-
- std::string off_input_file(argv[1]);
- // Read the OFF file (input file name given as parameter) and triangulate points
- Gudhi::Points_off_reader<Point_d> off_reader(off_input_file);
- // Check the read operation was correct
- if (!off_reader.is_valid()) {
- std::cerr << "Unable to read file " << off_input_file << std::endl;
- usage(argv[0]);
- }
-
- // Retrieve the triangulation
- std::vector<Point_d> point_cloud = off_reader.get_point_cloud();
-
- int n {};
- for (auto point : point_cloud) {
- std::cout << "Point[" << n << "] = ";
- for (std::size_t i {0}; i < point.size(); i++)
- std::cout << point[i] << " ";
- std::cout << "\n";
- ++n;
- }
- return 0;
-}
diff --git a/example/common/example_vector_double_points_off_reader.cpp b/example/common/example_vector_double_points_off_reader.cpp
deleted file mode 100644
index 5093da85..00000000
--- a/example/common/example_vector_double_points_off_reader.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <gudhi/Points_off_io.h>
-
-#include <iostream>
-#include <string>
-#include <vector>
-
-using Point_d = std::vector<double>;
-
-void usage(char * const progName) {
- std::cerr << "Usage: " << progName << " inputFile.off" << std::endl;
- exit(-1);
-}
-
-int main(int argc, char **argv) {
- if (argc != 2) {
- std::cerr << "Error: Number of arguments (" << argc << ") is not correct" << std::endl;
- usage(argv[0]);
- }
-
- std::string off_input_file(argv[1]);
- // Read the OFF file (input file name given as parameter) and triangulate points
- Gudhi::Points_off_reader<Point_d> off_reader(off_input_file);
- // Check the read operation was correct
- if (!off_reader.is_valid()) {
- std::cerr << "Unable to read file " << off_input_file << std::endl;
- usage(argv[0]);
- }
-
- // Retrieve the triangulation
- std::vector<Point_d> point_cloud = off_reader.get_point_cloud();
-
- std::ofstream output_file(off_input_file + ".txt");
- int n {0};
- for (auto point : point_cloud) {
- output_file << "Point[" << n << "] = ";
- for (std::size_t i {0}; i < point.size(); i++)
- output_file << point[i] << " ";
- output_file << "\n";
- ++n;
- }
- output_file.close();
- return 0;
-}
diff --git a/example/common/vectordoubleoffreader_result.txt b/example/common/vectordoubleoffreader_result.txt
deleted file mode 100644
index 1deb8dbd..00000000
--- a/example/common/vectordoubleoffreader_result.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Point[0] = 1 1
-Point[1] = 7 0
-Point[2] = 4 6
-Point[3] = 9 6
-Point[4] = 0 14
-Point[5] = 2 19
-Point[6] = 9 17