From c524232f734de875d69e2f190f01a6c976024368 Mon Sep 17 00:00:00 2001 From: Gard Spreemann Date: Thu, 14 Jun 2018 20:39:01 +0200 Subject: GUDHI 2.2.0 as released by upstream in a tarball. --- example/Alpha_complex/CMakeLists.txt | 1 - example/Bitmap_cubical_complex/CMakeLists.txt | 1 - .../Random_bitmap_cubical_complex.cpp | 2 +- example/Bottleneck_distance/CMakeLists.txt | 1 - .../alpha_rips_persistence_bottleneck_distance.cpp | 2 +- .../bottleneck_basic_example.cpp | 2 +- example/Cech_complex/CMakeLists.txt | 16 ++ .../cech_complex_example_from_points.cpp | 54 +++++++ .../cech_complex_example_from_points_for_doc.txt | 31 ++++ example/Cech_complex/cech_complex_step_by_step.cpp | 166 +++++++++++++++++++++ example/Contraction/CMakeLists.txt | 1 - example/Contraction/Garland_heckbert.cpp | 2 +- .../Contraction/Garland_heckbert/Error_quadric.h | 2 +- example/Contraction/Rips_contraction.cpp | 2 +- example/Nerve_GIC/CMakeLists.txt | 10 +- example/Nerve_GIC/CoordGIC.cpp | 5 +- example/Nerve_GIC/FuncGIC.cpp | 2 +- example/Persistence_representations/CMakeLists.txt | 9 +- .../persistence_heat_maps.cpp | 2 +- .../persistence_intervals.cpp | 2 +- .../persistence_landscape.cpp | 2 +- .../persistence_landscape_on_grid.cpp | 2 +- .../persistence_vectors.cpp | 2 +- example/Persistent_cohomology/CMakeLists.txt | 1 - .../custom_persistence_sort.cpp | 2 +- .../persistence_from_file.cpp | 2 +- .../persistence_from_simple_simplex_tree.cpp | 2 +- example/Persistent_cohomology/plain_homology.cpp | 2 +- .../rips_multifield_persistence.cpp | 2 +- .../rips_persistence_step_by_step.cpp | 2 +- .../rips_persistence_via_boundary_matrix.cpp | 2 +- example/Rips_complex/CMakeLists.txt | 14 +- ...e_one_skeleton_rips_from_correlation_matrix.cpp | 81 ++++++++++ example/Rips_complex/example_sparse_rips.cpp | 30 ++++ ...eleton_rips_from_correlation_matrix_for_doc.txt | 17 +++ example/Simplex_tree/CMakeLists.txt | 1 - .../cech_complex_cgal_mini_sphere_3d.cpp | 4 +- ...e_alpha_shapes_3_simplex_tree_from_off_file.cpp | 2 +- .../Simplex_tree/graph_expansion_with_blocker.cpp | 46 +++--- example/Simplex_tree/mini_simplex_tree.cpp | 2 +- example/Simplex_tree/simple_simplex_tree.cpp | 2 +- .../simplex_tree_from_cliques_of_graph.cpp | 2 +- example/Skeleton_blocker/CMakeLists.txt | 1 - .../Skeleton_blocker_from_simplices.cpp | 2 +- .../Skeleton_blocker_iteration.cpp | 2 +- example/Skeleton_blocker/Skeleton_blocker_link.cpp | 2 +- example/Spatial_searching/CMakeLists.txt | 1 - example/Subsampling/CMakeLists.txt | 1 - example/Tangential_complex/CMakeLists.txt | 1 - example/Witness_complex/CMakeLists.txt | 1 - .../example_nearest_landmark_table.cpp | 22 --- .../example_strong_witness_complex_off.cpp | 22 --- .../example_witness_complex_sphere.cpp | 22 --- example/Witness_complex/generators.h | 8 +- example/common/CMakeLists.txt | 12 +- example/common/cgaloffreader_result.txt | 7 - .../common/example_CGAL_3D_points_off_reader.cpp | 6 +- example/common/example_CGAL_points_off_reader.cpp | 6 +- .../example_vector_double_points_off_reader.cpp | 14 +- example/common/vectordoubleoffreader_result.txt | 7 + 60 files changed, 509 insertions(+), 163 deletions(-) create mode 100644 example/Cech_complex/CMakeLists.txt create mode 100644 example/Cech_complex/cech_complex_example_from_points.cpp create mode 100644 example/Cech_complex/cech_complex_example_from_points_for_doc.txt create mode 100644 example/Cech_complex/cech_complex_step_by_step.cpp create mode 100644 example/Rips_complex/example_one_skeleton_rips_from_correlation_matrix.cpp create mode 100644 example/Rips_complex/example_sparse_rips.cpp create mode 100644 example/Rips_complex/one_skeleton_rips_from_correlation_matrix_for_doc.txt delete mode 100644 example/common/cgaloffreader_result.txt create mode 100644 example/common/vectordoubleoffreader_result.txt (limited to 'example') diff --git a/example/Alpha_complex/CMakeLists.txt b/example/Alpha_complex/CMakeLists.txt index 5bf553e9..2fc62452 100644 --- a/example/Alpha_complex/CMakeLists.txt +++ b/example/Alpha_complex/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Alpha_complex_examples) # need CGAL 4.7 diff --git a/example/Bitmap_cubical_complex/CMakeLists.txt b/example/Bitmap_cubical_complex/CMakeLists.txt index 99304aa4..dc659f2d 100644 --- a/example/Bitmap_cubical_complex/CMakeLists.txt +++ b/example/Bitmap_cubical_complex/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Bitmap_cubical_complex_examples) add_executable ( Random_bitmap_cubical_complex Random_bitmap_cubical_complex.cpp ) diff --git a/example/Bitmap_cubical_complex/Random_bitmap_cubical_complex.cpp b/example/Bitmap_cubical_complex/Random_bitmap_cubical_complex.cpp index f70558f2..6eb24040 100644 --- a/example/Bitmap_cubical_complex/Random_bitmap_cubical_complex.cpp +++ b/example/Bitmap_cubical_complex/Random_bitmap_cubical_complex.cpp @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Saclay (France) + * 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 diff --git a/example/Bottleneck_distance/CMakeLists.txt b/example/Bottleneck_distance/CMakeLists.txt index 6095d6eb..c6f10127 100644 --- a/example/Bottleneck_distance/CMakeLists.txt +++ b/example/Bottleneck_distance/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Bottleneck_distance_examples) if (NOT CGAL_VERSION VERSION_LESS 4.8.1) diff --git a/example/Bottleneck_distance/alpha_rips_persistence_bottleneck_distance.cpp b/example/Bottleneck_distance/alpha_rips_persistence_bottleneck_distance.cpp index fd164b22..1e27887c 100644 --- a/example/Bottleneck_distance/alpha_rips_persistence_bottleneck_distance.cpp +++ b/example/Bottleneck_distance/alpha_rips_persistence_bottleneck_distance.cpp @@ -4,7 +4,7 @@ * * Author(s): Vincent Rouvreau * - * Copyright (C) 2017 INRIA + * 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 diff --git a/example/Bottleneck_distance/bottleneck_basic_example.cpp b/example/Bottleneck_distance/bottleneck_basic_example.cpp index d0ca4e20..3df7d12d 100644 --- a/example/Bottleneck_distance/bottleneck_basic_example.cpp +++ b/example/Bottleneck_distance/bottleneck_basic_example.cpp @@ -4,7 +4,7 @@ * * Authors: Francois Godi, small modifications by Pawel Dlotko * - * Copyright (C) 2015 INRIA + * 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 diff --git a/example/Cech_complex/CMakeLists.txt b/example/Cech_complex/CMakeLists.txt new file mode 100644 index 00000000..ab391215 --- /dev/null +++ b/example/Cech_complex/CMakeLists.txt @@ -0,0 +1,16 @@ +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 $ + "${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 $) diff --git a/example/Cech_complex/cech_complex_example_from_points.cpp b/example/Cech_complex/cech_complex_example_from_points.cpp new file mode 100644 index 00000000..3cc5a4df --- /dev/null +++ b/example/Cech_complex/cech_complex_example_from_points.cpp @@ -0,0 +1,54 @@ +#include +#include + +#include +#include +#include +#include + +int main() { + // Type definitions + using Point_cloud = std::vector>; + using Simplex_tree = Gudhi::Simplex_tree; + using Filtration_value = Simplex_tree::Filtration_value; + using Cech_complex = Gudhi::cech_complex::Cech_complex; + + 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 new file mode 100644 index 00000000..be0afc76 --- /dev/null +++ b/example/Cech_complex/cech_complex_example_from_points_for_doc.txt @@ -0,0 +1,31 @@ +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 new file mode 100644 index 00000000..d2dc8b65 --- /dev/null +++ b/example/Cech_complex/cech_complex_step_by_step.cpp @@ -0,0 +1,166 @@ +/* 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 . + */ + +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include // infinity +#include // for pair +#include + +// ---------------------------------------------------------------------------- +// 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; +using Points_off_reader = Gudhi::Points_off_reader; +using Proximity_graph = Gudhi::Proximity_graph; + +class Cech_blocker { + private: + using Point_cloud = std::vector; + using Point_iterator = Point_cloud::const_iterator; + using Coordinate_iterator = Point::const_iterator; + using Min_sphere = Gudhi::Miniball::Miniball>; + + public: + bool operator()(Simplex_handle sh) { + std::vector 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_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_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(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(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(&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(&max_radius)->default_value(std::numeric_limits::infinity()), + "Maximal length of an edge for the Rips complex construction.")( + "cpx-dimension,d", po::value(&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; + std::abort(); + } +} diff --git a/example/Contraction/CMakeLists.txt b/example/Contraction/CMakeLists.txt index a92d1685..582b7ab8 100644 --- a/example/Contraction/CMakeLists.txt +++ b/example/Contraction/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Contraction_examples) add_executable(RipsContraction Rips_contraction.cpp) diff --git a/example/Contraction/Garland_heckbert.cpp b/example/Contraction/Garland_heckbert.cpp index 2b0dc973..08dd932e 100644 --- a/example/Contraction/Garland_heckbert.cpp +++ b/example/Contraction/Garland_heckbert.cpp @@ -4,7 +4,7 @@ * * Author(s): David Salinas * - * Copyright (C) 2014 INRIA Sophia Antipolis-M�diterran�e (France) + * 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 diff --git a/example/Contraction/Garland_heckbert/Error_quadric.h b/example/Contraction/Garland_heckbert/Error_quadric.h index e7dafaa0..8bd9b545 100644 --- a/example/Contraction/Garland_heckbert/Error_quadric.h +++ b/example/Contraction/Garland_heckbert/Error_quadric.h @@ -4,7 +4,7 @@ * * Author(s): David Salinas * - * Copyright (C) 2014 INRIA Sophia Antipolis-M�diterran�e (France) + * 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 diff --git a/example/Contraction/Rips_contraction.cpp b/example/Contraction/Rips_contraction.cpp index 501b0e87..7f9b150a 100644 --- a/example/Contraction/Rips_contraction.cpp +++ b/example/Contraction/Rips_contraction.cpp @@ -4,7 +4,7 @@ * * Author(s): David Salinas * - * Copyright (C) 2014 INRIA Sophia Antipolis-Mediterranee (France) + * 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 diff --git a/example/Nerve_GIC/CMakeLists.txt b/example/Nerve_GIC/CMakeLists.txt index f2626927..fdecf86e 100644 --- a/example/Nerve_GIC/CMakeLists.txt +++ b/example/Nerve_GIC/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Nerve_GIC_examples) if (NOT CGAL_VERSION VERSION_LESS 4.8.1) @@ -17,10 +16,13 @@ if (NOT CGAL_VERSION VERSION_LESS 4.8.1) 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 $ - "tore3D_1307.off" "0") + "${CMAKE_CURRENT_BINARY_DIR}/tore3D_1307.off" "0") add_test(NAME Nerve_GIC_example_FuncGIC COMMAND $ - "lucky_cat.off" - "lucky_cat_PCA1") + "${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 index c92cf235..73edae18 100644 --- a/example/Nerve_GIC/CoordGIC.cpp +++ b/example/Nerve_GIC/CoordGIC.cpp @@ -4,7 +4,7 @@ * * Author(s): Mathieu Carrière * - * Copyright (C) 2017 INRIA + * 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 @@ -66,6 +66,9 @@ int main(int argc, char **argv) { GIC.find_simplices(); + GIC.compute_distribution(10); + GIC.compute_p_value(); + GIC.plot_DOT(); Gudhi::Simplex_tree<> stree; diff --git a/example/Nerve_GIC/FuncGIC.cpp b/example/Nerve_GIC/FuncGIC.cpp index cb0f0d63..1f5de999 100644 --- a/example/Nerve_GIC/FuncGIC.cpp +++ b/example/Nerve_GIC/FuncGIC.cpp @@ -4,7 +4,7 @@ * * Author(s): Mathieu Carrière * - * Copyright (C) 2017 INRIA + * 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 diff --git a/example/Persistence_representations/CMakeLists.txt b/example/Persistence_representations/CMakeLists.txt index eb3258f8..33558df3 100644 --- a/example/Persistence_representations/CMakeLists.txt +++ b/example/Persistence_representations/CMakeLists.txt @@ -1,27 +1,28 @@ -cmake_minimum_required(VERSION 2.6) 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 $) +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 $) +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 $ "${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 $) +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 $) - - - +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 index 2a472ac6..323b57e9 100644 --- a/example/Persistence_representations/persistence_heat_maps.cpp +++ b/example/Persistence_representations/persistence_heat_maps.cpp @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2016 INRIA (France) + * 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 diff --git a/example/Persistence_representations/persistence_intervals.cpp b/example/Persistence_representations/persistence_intervals.cpp index c1ceb458..b5dcf25c 100644 --- a/example/Persistence_representations/persistence_intervals.cpp +++ b/example/Persistence_representations/persistence_intervals.cpp @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2016 INRIA (France) + * 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 diff --git a/example/Persistence_representations/persistence_landscape.cpp b/example/Persistence_representations/persistence_landscape.cpp index 400a9ae1..27542cf7 100644 --- a/example/Persistence_representations/persistence_landscape.cpp +++ b/example/Persistence_representations/persistence_landscape.cpp @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2016 INRIA (France) + * 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 diff --git a/example/Persistence_representations/persistence_landscape_on_grid.cpp b/example/Persistence_representations/persistence_landscape_on_grid.cpp index b201b397..0f471a67 100644 --- a/example/Persistence_representations/persistence_landscape_on_grid.cpp +++ b/example/Persistence_representations/persistence_landscape_on_grid.cpp @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2016 INRIA (France) + * 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 diff --git a/example/Persistence_representations/persistence_vectors.cpp b/example/Persistence_representations/persistence_vectors.cpp index 834ae644..072e530d 100644 --- a/example/Persistence_representations/persistence_vectors.cpp +++ b/example/Persistence_representations/persistence_vectors.cpp @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2016 INRIA (France) + * 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 diff --git a/example/Persistent_cohomology/CMakeLists.txt b/example/Persistent_cohomology/CMakeLists.txt index 18e2913b..0f731519 100644 --- a/example/Persistent_cohomology/CMakeLists.txt +++ b/example/Persistent_cohomology/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Persistent_cohomology_examples) add_executable(plain_homology plain_homology.cpp) diff --git a/example/Persistent_cohomology/custom_persistence_sort.cpp b/example/Persistent_cohomology/custom_persistence_sort.cpp index 64f2a4dc..35366144 100644 --- a/example/Persistent_cohomology/custom_persistence_sort.cpp +++ b/example/Persistent_cohomology/custom_persistence_sort.cpp @@ -4,7 +4,7 @@ * * Author(s): Vincent Rouvreau * - * Copyright (C) 2014 INRIA Saclay (France) + * 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 diff --git a/example/Persistent_cohomology/persistence_from_file.cpp b/example/Persistent_cohomology/persistence_from_file.cpp index eafa3fd5..c40434a4 100644 --- a/example/Persistent_cohomology/persistence_from_file.cpp +++ b/example/Persistent_cohomology/persistence_from_file.cpp @@ -4,7 +4,7 @@ * * Author(s): Vincent Rouvreau * - * Copyright (C) 2014 INRIA Saclay (France) + * 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 diff --git a/example/Persistent_cohomology/persistence_from_simple_simplex_tree.cpp b/example/Persistent_cohomology/persistence_from_simple_simplex_tree.cpp index 8ef479d4..ffccfd86 100644 --- a/example/Persistent_cohomology/persistence_from_simple_simplex_tree.cpp +++ b/example/Persistent_cohomology/persistence_from_simple_simplex_tree.cpp @@ -4,7 +4,7 @@ * * Author(s): Vincent Rouvreau * - * Copyright (C) 2014 INRIA + * 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 diff --git a/example/Persistent_cohomology/plain_homology.cpp b/example/Persistent_cohomology/plain_homology.cpp index a5ae09c8..a2256060 100644 --- a/example/Persistent_cohomology/plain_homology.cpp +++ b/example/Persistent_cohomology/plain_homology.cpp @@ -4,7 +4,7 @@ * * Author(s): Marc Glisse * - * Copyright (C) 2015 INRIA Saclay - Ile-de-France (France) + * 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 diff --git a/example/Persistent_cohomology/rips_multifield_persistence.cpp b/example/Persistent_cohomology/rips_multifield_persistence.cpp index dae36ed2..626ec2ef 100644 --- a/example/Persistent_cohomology/rips_multifield_persistence.cpp +++ b/example/Persistent_cohomology/rips_multifield_persistence.cpp @@ -4,7 +4,7 @@ * * Author(s): Clément Maria * - * Copyright (C) 2014 INRIA + * 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 diff --git a/example/Persistent_cohomology/rips_persistence_step_by_step.cpp b/example/Persistent_cohomology/rips_persistence_step_by_step.cpp index c1de0ef8..7c81fcfb 100644 --- a/example/Persistent_cohomology/rips_persistence_step_by_step.cpp +++ b/example/Persistent_cohomology/rips_persistence_step_by_step.cpp @@ -4,7 +4,7 @@ * * Author(s): Clément Maria * - * Copyright (C) 2014 INRIA Sophia Antipolis-Méditerranée (France) + * 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 diff --git a/example/Persistent_cohomology/rips_persistence_via_boundary_matrix.cpp b/example/Persistent_cohomology/rips_persistence_via_boundary_matrix.cpp index 9618f278..c7607dce 100644 --- a/example/Persistent_cohomology/rips_persistence_via_boundary_matrix.cpp +++ b/example/Persistent_cohomology/rips_persistence_via_boundary_matrix.cpp @@ -4,7 +4,7 @@ * * Author(s): Clément Maria, Marc Glisse * - * Copyright (C) 2014 INRIA + * 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 diff --git a/example/Rips_complex/CMakeLists.txt b/example/Rips_complex/CMakeLists.txt index 2940f164..e7772bdb 100644 --- a/example/Rips_complex/CMakeLists.txt +++ b/example/Rips_complex/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Rips_complex_examples) # Point cloud @@ -11,17 +10,29 @@ add_executable ( Rips_complex_example_one_skeleton_from_distance_matrix example_ 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 $) add_test(NAME Rips_complex_example_one_skeleton_from_distance_matrix COMMAND $) +add_test(NAME Rips_complex_example_sparse + COMMAND $) +add_test(NAME Rips_complex_example_one_skeleton_rips_from_correlation_matrix + COMMAND $) add_test(NAME Rips_complex_example_from_off_doc_12_1 COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" "12.0" "1" "${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader_result_12_1.txt") @@ -57,3 +68,4 @@ 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 new file mode 100644 index 00000000..05bacb9f --- /dev/null +++ b/example/Rips_complex/example_one_skeleton_rips_from_correlation_matrix.cpp @@ -0,0 +1,81 @@ +#include +#include +#include + +#include +#include +#include +#include // 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; + using Distance_matrix = std::vector>; + + // 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_sparse_rips.cpp b/example/Rips_complex/example_sparse_rips.cpp new file mode 100644 index 00000000..1c95b48c --- /dev/null +++ b/example/Rips_complex/example_sparse_rips.cpp @@ -0,0 +1,30 @@ +#include +#include +#include + +#include +#include + +int main() { + using Point = std::vector; + using Simplex_tree = Gudhi::Simplex_tree; + using Filtration_value = Simplex_tree::Filtration_value; + using Sparse_rips = Gudhi::rips_complex::Sparse_rips_complex; + + 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/one_skeleton_rips_from_correlation_matrix_for_doc.txt b/example/Rips_complex/one_skeleton_rips_from_correlation_matrix_for_doc.txt new file mode 100644 index 00000000..640d7083 --- /dev/null +++ b/example/Rips_complex/one_skeleton_rips_from_correlation_matrix_for_doc.txt @@ -0,0 +1,17 @@ +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 index b33b2d05..857e8518 100644 --- a/example/Simplex_tree/CMakeLists.txt +++ b/example/Simplex_tree/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Simplex_tree_examples) add_executable ( Simplex_tree_example_from_cliques_of_graph simplex_tree_from_cliques_of_graph.cpp ) diff --git a/example/Simplex_tree/cech_complex_cgal_mini_sphere_3d.cpp b/example/Simplex_tree/cech_complex_cgal_mini_sphere_3d.cpp index 9bd51106..08ed74bb 100644 --- a/example/Simplex_tree/cech_complex_cgal_mini_sphere_3d.cpp +++ b/example/Simplex_tree/cech_complex_cgal_mini_sphere_3d.cpp @@ -2,9 +2,9 @@ * (Geometric Understanding in Higher Dimensions) is a generic C++ * library for computational topology. * - * Author(s): Clément Maria + * Author(s): Vincent Rouvreau * - * Copyright (C) 2014 INRIA Sophia Antipolis-Méditerranée (France) + * 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 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 index d8289ba9..290a9d9b 100644 --- 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 @@ -4,7 +4,7 @@ * * Author(s): Vincent Rouvreau * - * Copyright (C) 2014 INRIA Saclay (France) + * 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 diff --git a/example/Simplex_tree/graph_expansion_with_blocker.cpp b/example/Simplex_tree/graph_expansion_with_blocker.cpp index 0d458cbd..f39de31f 100644 --- a/example/Simplex_tree/graph_expansion_with_blocker.cpp +++ b/example/Simplex_tree/graph_expansion_with_blocker.cpp @@ -4,7 +4,7 @@ * * Author(s): Vincent Rouvreau * - * Copyright (C) 2014 + * 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 @@ -29,33 +29,33 @@ 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 simplexTree; + Simplex_tree stree; - simplexTree.insert_simplex({0, 1}, 0.); - simplexTree.insert_simplex({0, 2}, 1.); - simplexTree.insert_simplex({0, 3}, 2.); - simplexTree.insert_simplex({1, 2}, 3.); - simplexTree.insert_simplex({1, 3}, 4.); - simplexTree.insert_simplex({2, 3}, 5.); - simplexTree.insert_simplex({2, 4}, 6.); - simplexTree.insert_simplex({3, 6}, 7.); - simplexTree.insert_simplex({4, 5}, 8.); - simplexTree.insert_simplex({4, 6}, 9.); - simplexTree.insert_simplex({5, 6}, 10.); - simplexTree.insert_simplex({6}, 10.); + 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.); - simplexTree.expansion_with_blockers(3, [&](Simplex_handle sh) { + 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 : simplexTree.simplex_vertex_range(sh)) { + 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 << "] ( " << simplexTree.filtration(sh); + std::cout << "] ( " << stree.filtration(sh); // User can re-assign a new filtration value directly in the blocker (default is the maximal value of boudaries) - simplexTree.assign_filtration(sh, simplexTree.filtration(sh) + 1.); + stree.assign_filtration(sh, stree.filtration(sh) + 1.); std::cout << " + 1. ) = " << result << std::endl; @@ -63,13 +63,13 @@ int main(int argc, char* const argv[]) { }); std::cout << "********************************************************************\n"; - std::cout << "* The complex contains " << simplexTree.num_simplices() << " simplices"; - std::cout << " - dimension " << simplexTree.dimension() << "\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 : simplexTree.filtration_simplex_range()) { + for (auto f_simplex : stree.filtration_simplex_range()) { std::cout << " " - << "[" << simplexTree.filtration(f_simplex) << "] "; - for (auto vertex : simplexTree.simplex_vertex_range(f_simplex)) std::cout << "(" << vertex << ")"; + << "[" << stree.filtration(f_simplex) << "] "; + for (auto vertex : stree.simplex_vertex_range(f_simplex)) std::cout << "(" << vertex << ")"; std::cout << std::endl; } diff --git a/example/Simplex_tree/mini_simplex_tree.cpp b/example/Simplex_tree/mini_simplex_tree.cpp index 19e45361..e7c7177f 100644 --- a/example/Simplex_tree/mini_simplex_tree.cpp +++ b/example/Simplex_tree/mini_simplex_tree.cpp @@ -4,7 +4,7 @@ * * Author(s): Marc Glisse * - * Copyright (C) 2015 INRIA Saclay - Ile-de-France (France) + * 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 diff --git a/example/Simplex_tree/simple_simplex_tree.cpp b/example/Simplex_tree/simple_simplex_tree.cpp index 828977c2..d71b5608 100644 --- a/example/Simplex_tree/simple_simplex_tree.cpp +++ b/example/Simplex_tree/simple_simplex_tree.cpp @@ -4,7 +4,7 @@ * * Author(s): Vincent Rouvreau * - * Copyright (C) 2014 + * 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 diff --git a/example/Simplex_tree/simplex_tree_from_cliques_of_graph.cpp b/example/Simplex_tree/simplex_tree_from_cliques_of_graph.cpp index d1b8b2de..6d70f3d1 100644 --- a/example/Simplex_tree/simplex_tree_from_cliques_of_graph.cpp +++ b/example/Simplex_tree/simplex_tree_from_cliques_of_graph.cpp @@ -4,7 +4,7 @@ * * Author(s): Clément Maria * - * Copyright (C) 2014 INRIA + * 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 diff --git a/example/Skeleton_blocker/CMakeLists.txt b/example/Skeleton_blocker/CMakeLists.txt index de70f089..0e5d2f11 100644 --- a/example/Skeleton_blocker/CMakeLists.txt +++ b/example/Skeleton_blocker/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Skeleton_blocker_examples) add_executable(Skeleton_blocker_example_from_simplices Skeleton_blocker_from_simplices.cpp) diff --git a/example/Skeleton_blocker/Skeleton_blocker_from_simplices.cpp b/example/Skeleton_blocker/Skeleton_blocker_from_simplices.cpp index 076c6a53..f288e39c 100644 --- a/example/Skeleton_blocker/Skeleton_blocker_from_simplices.cpp +++ b/example/Skeleton_blocker/Skeleton_blocker_from_simplices.cpp @@ -4,7 +4,7 @@ * * Author(s): David Salinas * - * Copyright (C) 2014 INRIA + * 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 diff --git a/example/Skeleton_blocker/Skeleton_blocker_iteration.cpp b/example/Skeleton_blocker/Skeleton_blocker_iteration.cpp index 08ff0264..4d008450 100644 --- a/example/Skeleton_blocker/Skeleton_blocker_iteration.cpp +++ b/example/Skeleton_blocker/Skeleton_blocker_iteration.cpp @@ -4,7 +4,7 @@ * * Author(s): David Salinas * - * Copyright (C) 2014 INRIA + * 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 diff --git a/example/Skeleton_blocker/Skeleton_blocker_link.cpp b/example/Skeleton_blocker/Skeleton_blocker_link.cpp index 58322038..2ec72128 100644 --- a/example/Skeleton_blocker/Skeleton_blocker_link.cpp +++ b/example/Skeleton_blocker/Skeleton_blocker_link.cpp @@ -4,7 +4,7 @@ * * Author(s): David Salinas * - * Copyright (C) 2014 INRIA + * 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 diff --git a/example/Spatial_searching/CMakeLists.txt b/example/Spatial_searching/CMakeLists.txt index 4cf3d863..0f799987 100644 --- a/example/Spatial_searching/CMakeLists.txt +++ b/example/Spatial_searching/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Spatial_searching_examples) if(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/example/Subsampling/CMakeLists.txt b/example/Subsampling/CMakeLists.txt index 34400b1e..f26d107f 100644 --- a/example/Subsampling/CMakeLists.txt +++ b/example/Subsampling/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Subsampling_examples) if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/example/Tangential_complex/CMakeLists.txt b/example/Tangential_complex/CMakeLists.txt index 16d1339d..af0dac51 100644 --- a/example/Tangential_complex/CMakeLists.txt +++ b/example/Tangential_complex/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Tangential_complex_examples) if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/example/Witness_complex/CMakeLists.txt b/example/Witness_complex/CMakeLists.txt index a8231392..3d838c0d 100644 --- a/example/Witness_complex/CMakeLists.txt +++ b/example/Witness_complex/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 2.6) project(Witness_complex_examples) add_executable ( Witness_complex_example_nearest_landmark_table example_nearest_landmark_table.cpp ) diff --git a/example/Witness_complex/example_nearest_landmark_table.cpp b/example/Witness_complex/example_nearest_landmark_table.cpp index b8594212..acaf7c54 100644 --- a/example/Witness_complex/example_nearest_landmark_table.cpp +++ b/example/Witness_complex/example_nearest_landmark_table.cpp @@ -1,25 +1,3 @@ -/* 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) 2016 INRIA (France) - * - * 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 . - */ - #define BOOST_PARAMETER_MAX_ARITY 12 #include diff --git a/example/Witness_complex/example_strong_witness_complex_off.cpp b/example/Witness_complex/example_strong_witness_complex_off.cpp index 346bef6d..19f73836 100644 --- a/example/Witness_complex/example_strong_witness_complex_off.cpp +++ b/example/Witness_complex/example_strong_witness_complex_off.cpp @@ -1,25 +1,3 @@ -/* 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) 2016 INRIA (France) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - #include #include #include diff --git a/example/Witness_complex/example_witness_complex_sphere.cpp b/example/Witness_complex/example_witness_complex_sphere.cpp index a6e9b11a..9e3c972d 100644 --- a/example/Witness_complex/example_witness_complex_sphere.cpp +++ b/example/Witness_complex/example_witness_complex_sphere.cpp @@ -1,25 +1,3 @@ -/* 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) 2016 INRIA (France) - * - * 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 . - */ - #define BOOST_PARAMETER_MAX_ARITY 12 #include diff --git a/example/Witness_complex/generators.h b/example/Witness_complex/generators.h index 7df43db5..4b755daa 100644 --- a/example/Witness_complex/generators.h +++ b/example/Witness_complex/generators.h @@ -4,7 +4,7 @@ * * Author(s): Siargey Kachanovich * - * Copyright (C) 2015 INRIA Sophia Antipolis-Méditerranée (France) + * 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 @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef EXAMPLE_WITNESS_COMPLEX_GENERATORS_H_ -#define EXAMPLE_WITNESS_COMPLEX_GENERATORS_H_ +#ifndef GENERATORS_H_ +#define GENERATORS_H_ #include #include @@ -163,4 +163,4 @@ void generate_points_torus(Point_Vector& W, int nbP, int dim) { } } -#endif // EXAMPLE_WITNESS_COMPLEX_GENERATORS_H_ +#endif // GENERATORS_H_ diff --git a/example/common/CMakeLists.txt b/example/common/CMakeLists.txt index afe865d4..04015cdc 100644 --- a/example/common/CMakeLists.txt +++ b/example/common/CMakeLists.txt @@ -1,13 +1,21 @@ -cmake_minimum_required(VERSION 2.6) 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 $ - "${CMAKE_SOURCE_DIR}/data/points/SO3_10000.off") + "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}) diff --git a/example/common/cgaloffreader_result.txt b/example/common/cgaloffreader_result.txt deleted file mode 100644 index 1deb8dbd..00000000 --- a/example/common/cgaloffreader_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 diff --git a/example/common/example_CGAL_3D_points_off_reader.cpp b/example/common/example_CGAL_3D_points_off_reader.cpp index 665b7a29..4658d8d5 100644 --- a/example/common/example_CGAL_3D_points_off_reader.cpp +++ b/example/common/example_CGAL_3D_points_off_reader.cpp @@ -20,12 +20,12 @@ int main(int argc, char **argv) { usage(argv[0]); } - std::string offInputFile(argv[1]); + 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 off_reader(offInputFile); + Gudhi::Points_3D_off_reader off_reader(off_input_file); // Check the read operation was correct if (!off_reader.is_valid()) { - std::cerr << "Unable to read file " << offInputFile << std::endl; + std::cerr << "Unable to read file " << off_input_file << std::endl; usage(argv[0]); } diff --git a/example/common/example_CGAL_points_off_reader.cpp b/example/common/example_CGAL_points_off_reader.cpp index 8c6a6b54..f45683a5 100644 --- a/example/common/example_CGAL_points_off_reader.cpp +++ b/example/common/example_CGAL_points_off_reader.cpp @@ -22,12 +22,12 @@ int main(int argc, char **argv) { usage(argv[0]); } - std::string offInputFile(argv[1]); + std::string off_input_file(argv[1]); // Read the OFF file (input file name given as parameter) and triangulate points - Gudhi::Points_off_reader off_reader(offInputFile); + Gudhi::Points_off_reader off_reader(off_input_file); // Check the read operation was correct if (!off_reader.is_valid()) { - std::cerr << "Unable to read file " << offInputFile << std::endl; + std::cerr << "Unable to read file " << off_input_file << std::endl; usage(argv[0]); } diff --git a/example/common/example_vector_double_points_off_reader.cpp b/example/common/example_vector_double_points_off_reader.cpp index 8aecb26e..5093da85 100644 --- a/example/common/example_vector_double_points_off_reader.cpp +++ b/example/common/example_vector_double_points_off_reader.cpp @@ -17,25 +17,27 @@ int main(int argc, char **argv) { usage(argv[0]); } - std::string offInputFile(argv[1]); + std::string off_input_file(argv[1]); // Read the OFF file (input file name given as parameter) and triangulate points - Gudhi::Points_off_reader off_reader(offInputFile); + Gudhi::Points_off_reader off_reader(off_input_file); // Check the read operation was correct if (!off_reader.is_valid()) { - std::cerr << "Unable to read file " << offInputFile << std::endl; + std::cerr << "Unable to read file " << off_input_file << std::endl; usage(argv[0]); } // Retrieve the triangulation std::vector point_cloud = off_reader.get_point_cloud(); + std::ofstream output_file(off_input_file + ".txt"); int n {0}; for (auto point : point_cloud) { - std::cout << "Point[" << n << "] = "; + output_file << "Point[" << n << "] = "; for (std::size_t i {0}; i < point.size(); i++) - std::cout << point[i] << " "; - std::cout << "\n"; + 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 new file mode 100644 index 00000000..1deb8dbd --- /dev/null +++ b/example/common/vectordoubleoffreader_result.txt @@ -0,0 +1,7 @@ +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 -- cgit v1.2.3