From bef47576f91c005417ac589b91f6c236fa5a1b60 Mon Sep 17 00:00:00 2001 From: pdlotko Date: Thu, 30 Jun 2016 07:59:24 +0000 Subject: removing files again git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/gudhi_stat@1361 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 9d7b3d461e8de61bed508754106ed3d8f2af0aab --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e85be8a..e22be07b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,6 +111,7 @@ endif() include_directories(src/Simplex_tree/include/) include_directories(src/Skeleton_blocker/include/) include_directories(src/Witness_complex/include/) + include_directories(src/Gudhi_stat/include/) add_subdirectory(src/common/example) add_subdirectory(src/common/test) @@ -127,6 +128,8 @@ endif() add_subdirectory(src/Bitmap_cubical_complex/example) add_subdirectory(src/Alpha_complex/example) add_subdirectory(src/Alpha_complex/test) + add_subdirectory(src/Gudhi_stat/test) + add_subdirectory(src/Gudhi_stat/example) # data points generator add_subdirectory(data/points/generator) -- cgit v1.2.3 From 7a6ebbd6c26306bca806bbc8c08f74a13c63fca6 Mon Sep 17 00:00:00 2001 From: pdlotko Date: Tue, 11 Oct 2016 07:43:50 +0000 Subject: adding answert to Vincent's comments git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/gudhi_stat@1688 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 3e90519425010bfedae7af946238188fee6cf420 --- CMakeLists.txt | 1 + src/Gudhi_stat/example/CMakeLists.txt | 98 ---------- src/Gudhi_stat/example/persistence_heat_maps.cpp | 2 +- src/Gudhi_stat/example/persistence_intervals.cpp | 2 +- src/Gudhi_stat/example/persistence_landscape.cpp | 2 +- .../example/persistence_landscape_on_grid.cpp | 2 +- .../average_persistence_heat_maps.cpp | 73 -------- .../compute_distance_of_persistence_heat_maps.cpp | 107 ----------- ...ute_scalar_product_of_persistence_heat_maps.cpp | 91 --------- .../create_persistence_heat_maps.cpp | 79 -------- ...aps_weighted_by_arctan_of_their_persistence.cpp | 79 -------- ...eat_maps_weighted_by_distance_from_diagonal.cpp | 79 -------- ..._weighted_by_squared_distance_from_diagonal.cpp | 79 -------- .../persistence_heat_maps/create_pssk.cpp | 77 -------- .../plot_persistence_heat_map.cpp | 44 ----- .../example/utilities/persistence_intervals/aaa | 51 ----- .../persistence_intervals/aaa_Gnuplot_script | 208 --------------------- ...te_birth_death_range_in_persistence_diagram.cpp | 72 ------- .../compute_number_of_dominant_intervals.cpp | 57 ------ .../plot_histogram_of_intervals_lengths.cpp | 69 ------- .../plot_persistence_Betti_numebrs.cpp | 93 --------- .../plot_persistence_intervals.cpp | 59 ------ .../persistence_landscapes/average_landscapes.cpp | 75 -------- .../compute_distance_of_landscapes.cpp | 109 ----------- .../compute_scalar_product_of_landscapes.cpp | 92 --------- .../persistence_landscapes/create_landscapes.cpp | 56 ------ .../persistence_landscapes/plot_landscapes.cpp | 50 ----- .../average_landscapes_on_grid.cpp | 74 -------- .../compute_distance_of_landscapes_on_grid.cpp | 107 ----------- ...ompute_scalar_product_of_landscapes_on_grid.cpp | 91 --------- .../create_landscapes_on_grid.cpp | 80 -------- .../plot_landscapes_on_grid.cpp | 55 ------ .../average_persistence_vectors.cpp | 75 -------- .../compute_distance_of_persistence_vectors.cpp | 108 ----------- ...mpute_scalar_product_of_persistence_vectors.cpp | 97 ---------- .../create_persistence_vectors.cpp | 57 ------ .../plot_persistence_vectors.cpp | 51 ----- src/Gudhi_stat/example/vector_representation.cpp | 2 +- .../Abs_Real_valued_topological_data.h | 2 +- .../gudhi/abstract_classes/Abs_Topological_data.h | 10 +- .../Abs_Topological_data_with_averages.h | 9 +- .../Abs_Topological_data_with_distances.h | 9 +- .../Abs_Topological_data_with_scalar_product.h | 7 +- .../Abs_Vectorized_topological_data.h | 10 +- .../include/gudhi/concretizations/PSSK.h | 2 +- .../gudhi/concretizations/Persistence_heat_maps.h | 14 +- .../gudhi/concretizations/Persistence_intervals.h | 7 +- .../gudhi/concretizations/Persistence_landscape.h | 6 +- .../Persistence_landscape_on_grid.h | 42 +++-- .../concretizations/Vector_distances_in_diagram.h | 124 ++++++------ .../concretizations/read_persitence_from_file.h | 20 +- src/Gudhi_stat/test/persistence_heat_maps_test.cpp | 2 +- src/Gudhi_stat/test/persistence_intervals_test.cpp | 2 +- .../test/persistence_lanscapes_on_grid_test.cpp | 2 +- src/Gudhi_stat/test/persistence_lanscapes_test.cpp | 2 +- src/Gudhi_stat/test/vector_representation_test.cpp | 4 +- src/Gudhi_stat/utilities/CMakeLists.txt | 103 ++++++++++ .../average_persistence_heat_maps.cpp | 73 ++++++++ .../compute_distance_of_persistence_heat_maps.cpp | 107 +++++++++++ ...ute_scalar_product_of_persistence_heat_maps.cpp | 91 +++++++++ .../create_persistence_heat_maps.cpp | 79 ++++++++ ...aps_weighted_by_arctan_of_their_persistence.cpp | 79 ++++++++ ...eat_maps_weighted_by_distance_from_diagonal.cpp | 79 ++++++++ ..._weighted_by_squared_distance_from_diagonal.cpp | 79 ++++++++ .../persistence_heat_maps/create_pssk.cpp | 77 ++++++++ .../plot_persistence_heat_map.cpp | 44 +++++ ...te_birth_death_range_in_persistence_diagram.cpp | 72 +++++++ .../compute_number_of_dominant_intervals.cpp | 57 ++++++ .../plot_histogram_of_intervals_lengths.cpp | 69 +++++++ .../plot_persistence_Betti_numebrs.cpp | 93 +++++++++ .../plot_persistence_intervals.cpp | 59 ++++++ .../persistence_landscapes/average_landscapes.cpp | 75 ++++++++ .../compute_distance_of_landscapes.cpp | 109 +++++++++++ .../compute_scalar_product_of_landscapes.cpp | 92 +++++++++ .../persistence_landscapes/create_landscapes.cpp | 56 ++++++ .../persistence_landscapes/plot_landscapes.cpp | 50 +++++ .../average_landscapes_on_grid.cpp | 74 ++++++++ .../compute_distance_of_landscapes_on_grid.cpp | 107 +++++++++++ ...ompute_scalar_product_of_landscapes_on_grid.cpp | 91 +++++++++ .../create_landscapes_on_grid.cpp | 80 ++++++++ .../plot_landscapes_on_grid.cpp | 55 ++++++ .../average_persistence_vectors.cpp | 75 ++++++++ .../compute_distance_of_persistence_vectors.cpp | 108 +++++++++++ ...mpute_scalar_product_of_persistence_vectors.cpp | 97 ++++++++++ .../create_persistence_vectors.cpp | 57 ++++++ .../plot_persistence_vectors.cpp | 51 +++++ 86 files changed, 2494 insertions(+), 2721 deletions(-) delete mode 100644 src/Gudhi_stat/example/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_heat_maps/create_pssk.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_intervals/aaa delete mode 100644 src/Gudhi_stat/example/utilities/persistence_intervals/aaa_Gnuplot_script delete mode 100644 src/Gudhi_stat/example/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_intervals.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_landscapes/average_landscapes.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_landscapes/create_landscapes.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_landscapes/plot_landscapes.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_vectors/average_persistence_vectors.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_vectors/create_persistence_vectors.cpp delete mode 100644 src/Gudhi_stat/example/utilities/persistence_vectors/plot_persistence_vectors.cpp create mode 100644 src/Gudhi_stat/utilities/CMakeLists.txt create mode 100644 src/Gudhi_stat/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_heat_maps/create_pssk.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_intervals.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_landscapes/average_landscapes.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_landscapes/create_landscapes.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_landscapes/plot_landscapes.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_vectors/average_persistence_vectors.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_vectors/create_persistence_vectors.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_vectors/plot_persistence_vectors.cpp (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index d7078489..488f1d62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -145,6 +145,7 @@ else() add_subdirectory(src/Alpha_complex/test) add_subdirectory(src/Gudhi_stat/test) add_subdirectory(src/Gudhi_stat/example) + add_subdirectory(src/Gudhi_stat/utilities) # data points generator add_subdirectory(data/points/generator) diff --git a/src/Gudhi_stat/example/CMakeLists.txt b/src/Gudhi_stat/example/CMakeLists.txt index 613e4d26..5ae6cd6a 100644 --- a/src/Gudhi_stat/example/CMakeLists.txt +++ b/src/Gudhi_stat/example/CMakeLists.txt @@ -17,103 +17,5 @@ add_executable ( persistence_heat_maps persistence_heat_maps.cpp ) target_link_libraries(persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) -##UTILITIES: - -#persitence diagrams -add_executable ( plot_persistence_intervals utilities/persistence_intervals/plot_persistence_intervals.cpp ) -target_link_libraries( plot_persistence_intervals ${Boost_SYSTEM_LIBRARY}) - -add_executable ( compute_birth_death_range_in_persistence_diagram utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp ) -target_link_libraries( compute_birth_death_range_in_persistence_diagram ${Boost_SYSTEM_LIBRARY}) - -add_executable ( compute_number_of_dominant_intervals utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp ) -target_link_libraries( compute_number_of_dominant_intervals ${Boost_SYSTEM_LIBRARY}) - -add_executable ( plot_histogram_of_intervals_lengths utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp ) -target_link_libraries( plot_histogram_of_intervals_lengths ${Boost_SYSTEM_LIBRARY}) - -add_executable ( plot_persistence_Betti_numebrs utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp ) -target_link_libraries( plot_persistence_Betti_numebrs ${Boost_SYSTEM_LIBRARY}) - -#when we have bottleneck and wasserstein distance computations, add suitable programs here. - - -#persitence landscapes -add_executable ( average_landscapes utilities/persistence_landscapes/average_landscapes.cpp ) -target_link_libraries(average_landscapes ${Boost_SYSTEM_LIBRARY}) - -add_executable ( create_landscapes utilities/persistence_landscapes/create_landscapes.cpp ) -target_link_libraries(create_landscapes ${Boost_SYSTEM_LIBRARY}) - -add_executable ( plot_landscapes utilities/persistence_landscapes/plot_landscapes.cpp ) -target_link_libraries(plot_landscapes ${Boost_SYSTEM_LIBRARY}) - -add_executable ( compute_distance_of_landscapes utilities/persistence_landscapes/compute_distance_of_landscapes.cpp ) -target_link_libraries(compute_distance_of_landscapes ${Boost_SYSTEM_LIBRARY}) - -add_executable ( compute_scalar_product_of_landscapes utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp ) -target_link_libraries(compute_scalar_product_of_landscapes ${Boost_SYSTEM_LIBRARY}) - -#persitence landscapes on a grid -add_executable ( average_landscapes_on_grid utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp ) -target_link_libraries(average_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) - -add_executable ( create_landscapes_on_grid utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp ) -target_link_libraries(create_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) - -add_executable ( plot_landscapes_on_grid utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp ) -target_link_libraries(plot_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) - -add_executable ( compute_distance_of_landscapes_on_grid utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp ) -target_link_libraries(compute_distance_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) - -add_executable ( compute_scalar_product_of_landscapes_on_grid utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp ) -target_link_libraries(compute_scalar_product_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) - -#persitence heat maps -add_executable ( average_persistence_heat_maps utilities/persistence_heat_maps/average_persistence_heat_maps.cpp ) -target_link_libraries(average_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) - -add_executable ( create_persistence_heat_maps utilities/persistence_heat_maps/create_persistence_heat_maps.cpp ) -target_link_libraries(create_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) - -add_executable ( plot_persistence_heat_map utilities/persistence_heat_maps/plot_persistence_heat_map.cpp ) -target_link_libraries(plot_persistence_heat_map ${Boost_SYSTEM_LIBRARY}) - -add_executable ( compute_distance_of_persistence_heat_maps utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp ) -target_link_libraries(compute_distance_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) - -add_executable ( compute_scalar_product_of_persistence_heat_maps utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp ) -target_link_libraries(compute_scalar_product_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) - -add_executable ( create_pssk utilities/persistence_heat_maps/create_pssk.cpp ) -target_link_libraries(create_pssk ${Boost_SYSTEM_LIBRARY}) - -add_executable ( create_persistence_heat_maps_weighted_by_distance_from_diagonal utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp ) -target_link_libraries(create_persistence_heat_maps_weighted_by_distance_from_diagonal ${Boost_SYSTEM_LIBRARY}) - -add_executable ( create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp ) -target_link_libraries(create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal ${Boost_SYSTEM_LIBRARY}) - -add_executable ( create_persistence_heat_maps_weighted_by_arctan_of_their_persistence utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp ) -target_link_libraries(create_persistence_heat_maps_weighted_by_arctan_of_their_persistence ${Boost_SYSTEM_LIBRARY}) - - -#persitence vectors -add_executable ( average_persistence_vectors utilities/persistence_vectors/average_persistence_vectors.cpp ) -target_link_libraries(average_persistence_vectors ${Boost_SYSTEM_LIBRARY}) - -add_executable ( create_persistence_vectors utilities/persistence_vectors/create_persistence_vectors.cpp ) -target_link_libraries(create_persistence_vectors ${Boost_SYSTEM_LIBRARY}) - -add_executable ( compute_distance_of_persistence_vectors utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp ) -target_link_libraries(compute_distance_of_persistence_vectors ${Boost_SYSTEM_LIBRARY}) - -add_executable ( compute_scalar_product_of_persistence_vectors utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp ) -target_link_libraries(compute_scalar_product_of_persistence_vectors ${Boost_SYSTEM_LIBRARY}) - -add_executable ( plot_persistence_vectors utilities/persistence_vectors/plot_persistence_vectors.cpp ) -target_link_libraries(plot_persistence_vectors ${Boost_SYSTEM_LIBRARY}) - diff --git a/src/Gudhi_stat/example/persistence_heat_maps.cpp b/src/Gudhi_stat/example/persistence_heat_maps.cpp index cd0c4113..e336ab44 100644 --- a/src/Gudhi_stat/example/persistence_heat_maps.cpp +++ b/src/Gudhi_stat/example/persistence_heat_maps.cpp @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 diff --git a/src/Gudhi_stat/example/persistence_intervals.cpp b/src/Gudhi_stat/example/persistence_intervals.cpp index cbd4020d..5357def7 100644 --- a/src/Gudhi_stat/example/persistence_intervals.cpp +++ b/src/Gudhi_stat/example/persistence_intervals.cpp @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 diff --git a/src/Gudhi_stat/example/persistence_landscape.cpp b/src/Gudhi_stat/example/persistence_landscape.cpp index a5b726c7..3204148b 100644 --- a/src/Gudhi_stat/example/persistence_landscape.cpp +++ b/src/Gudhi_stat/example/persistence_landscape.cpp @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 diff --git a/src/Gudhi_stat/example/persistence_landscape_on_grid.cpp b/src/Gudhi_stat/example/persistence_landscape_on_grid.cpp index 2807d76f..e1a0ba5d 100644 --- a/src/Gudhi_stat/example/persistence_landscape_on_grid.cpp +++ b/src/Gudhi_stat/example/persistence_landscape_on_grid.cpp @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 diff --git a/src/Gudhi_stat/example/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp b/src/Gudhi_stat/example/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp deleted file mode 100644 index d90e78e1..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp +++ /dev/null @@ -1,73 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program computes average persistence landscape of persistence landscapes created based on persistence diagrams provided as an input. Please call this program with the names of files with persistence diagrams \n"; - std::vector< const char* > filenames; - - if ( argc == 1 ) - { - std::cout << "No input files given, the program will now terminate \n"; - return 1; - } - - for ( int i = 1 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - - std::cout << "Creating persistence landscapes...\n"; - std::vector< Abs_Topological_data_with_averages* > maps; - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - Persistence_heat_maps* l = new Persistence_heat_maps; - l->load_from_file( filenames[i] ); - maps.push_back( (Abs_Topological_data_with_averages*)l ); - } - - Persistence_heat_maps av; - av.compute_average( maps ); - - av.print_to_file( "average.mps" ); - - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - delete maps[i]; - } - - std::cout << "Done \n"; - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp b/src/Gudhi_stat/example/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp deleted file mode 100644 index 10d6f04c..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp +++ /dev/null @@ -1,107 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program compute dsitance of persistence landscapes stored in a file (the file needs to be created beforehand). \n"; - std::cout << "The first parameter of a program is an interger p. The program compute L^p distance of the two landscapes. For L^infty distance choose p = -1. \n"; - std::cout << "The remaining parameters of this programs are names of files with persistence landscapes.\n"; - - if ( argc < 3 ) - { - std::cout << "Wrong number of parameters, the program will now terminate \n"; - return 1; - } - - int p = atoi( argv[1] ); - - std::vector< const char* > filenames; - for ( int i = 2 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - std::vector< Abs_Topological_data_with_distances* > maps; - maps.reserve( filenames.size() ); - for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) - { - Persistence_heat_maps* l = new Persistence_heat_maps; - l->load_from_file( filenames[file_no] ); - maps.push_back( (Abs_Topological_data_with_distances*)l ); - } - - //and now we will compute the scalar product of landscapes. - - //first we prepare an array: - std::vector< std::vector< double > > distance( filenames.size() ); - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - std::vector< double > v( filenames.size() , 0 ); - distance[i] = v; - } - - //and now we can compute the distnaces: - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - for ( size_t j = i ; j != filenames.size() ; ++j ) - { - distance[i][j] = distance[j][i] = ((Persistence_heat_maps*)maps[i])->distance( maps[j] , p ) ; - } - } - - //and now output the result to the screen and a file: - ofstream out; - out.open( "distance" ); - for ( size_t i = 0 ; i != distance.size() ; ++i ) - { - for ( size_t j = 0 ; j != distance.size() ; ++j ) - { - cout << distance[i][j] << " "; - out << distance[i][j] << " "; - } - cout << endl; - out << endl; - } - out.close(); - - return 0; -} - - - - - - - diff --git a/src/Gudhi_stat/example/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp b/src/Gudhi_stat/example/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp deleted file mode 100644 index cd529f10..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp +++ /dev/null @@ -1,91 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program compute scalar product of persistence landscapes stored in a file (the file needs to be created beforehand). \n"; - std::cout << "The parameters of this programs are names of files with persistence landscapes.\n"; - - std::vector< const char* > filenames; - for ( int i = 1 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - std::vector< Persistence_heat_maps* > maps; - maps.reserve( filenames.size() ); - for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) - { - Persistence_heat_maps* l = new Persistence_heat_maps; - l->load_from_file( filenames[file_no] ); - maps.push_back( l ); - } - - //and now we will compute the scalar product of landscapes. - - //first we prepare an array: - std::vector< std::vector< double > > scalar_product( filenames.size() ); - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - std::vector< double > v( filenames.size() , 0 ); - scalar_product[i] = v; - } - - //and now we can compute the scalar product: - for ( size_t i = 0 ; i != maps.size() ; ++i ) - { - for ( size_t j = i ; j != maps.size() ; ++j ) - { - scalar_product[i][j] = scalar_product[j][i] = ((Persistence_heat_maps*)maps[i])->compute_scalar_product( maps[j] ) ; - } - } - - //and now output the result to the screen and a file: - ofstream out; - out.open( "scalar_product" ); - for ( size_t i = 0 ; i != scalar_product.size() ; ++i ) - { - for ( size_t j = 0 ; j != scalar_product.size() ; ++j ) - { - cout << scalar_product[i][j] << " "; - out << scalar_product[i][j] << " "; - } - cout << endl; - out << endl; - } - out.close(); - - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp b/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp deleted file mode 100644 index 3d8dc2e8..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp +++ /dev/null @@ -1,79 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - - -int main( int argc , char** argv ) -{ - std::cout << "This program creates persistence heat map of diagrams provided as an input.\n"; - std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; - std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n"; - std::cerr << "The fourth parameter is an integer, the standard deviation of a gaussian kernel expressed in a number of pixels \n"; - std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; - - if ( argc < 5 ) - { - std::cout << "Wrong parameter list, the program will now terminate \n"; - return 1; - } - - size_t size_of_grid = (size_t)atoi( argv[1] ); - double min_ = atof( argv[2] ); - double max_ = atof( argv[3] ); - size_t stdiv = atof( argv[4] ); - - std::vector< const char* > filenames; - for ( int i = 5 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - - - - std::cout << "Creating persistence heat maps...\n"; - std::vector< std::vector > filter = create_Gaussian_filter(stdiv,1); - - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; - Persistence_heat_maps l( filenames[i] , filter, constant_function, false , size_of_grid , min_ , max_ ); - - std::stringstream ss; - ss << filenames[i] << ".mps"; - l.print_to_file( ss.str().c_str() ); - } - std::cout << "Done \n"; - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp b/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp deleted file mode 100644 index 253320ff..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp +++ /dev/null @@ -1,79 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - - -int main( int argc , char** argv ) -{ - std::cout << "This program creates persistence heat map of diagrams provided as an input. The Gaussian kernels are weighted by the arcus tangens of their persistence.\n"; - std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; - std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n"; - std::cerr << "The fourth parameter is an integer, the standard deviation of a gaussian kernel expressed in a number of pixels \n"; - std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; - - if ( argc < 5 ) - { - std::cout << "Wrong parameter list, the program will now terminate \n"; - return 1; - } - - size_t size_of_grid = (size_t)atoi( argv[1] ); - double min_ = atof( argv[2] ); - double max_ = atof( argv[3] ); - size_t stdiv = atof( argv[4] ); - - std::vector< const char* > filenames; - for ( int i = 5 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - - - - std::cout << "Creating persistence heat maps...\n"; - std::vector< std::vector > filter = create_Gaussian_filter(stdiv,1); - - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; - Persistence_heat_maps l( filenames[i] , filter, arc_tan_of_persistence_of_point, false , size_of_grid , min_ , max_ ); - - std::stringstream ss; - ss << filenames[i] << ".mps"; - l.print_to_file( ss.str().c_str() ); - } - std::cout << "Done \n"; - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp b/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp deleted file mode 100644 index d7f4fbdd..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp +++ /dev/null @@ -1,79 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - - -int main( int argc , char** argv ) -{ - std::cout << "This program creates persistence heat map of diagrams provided as an input. The Gaussian kernels are weighted by the distance of a center from the diagonal.\n"; - std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; - std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n"; - std::cerr << "The fourth parameter is an integer, the standard deviation of a gaussian kernel expressed in a number of pixels \n"; - std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; - - if ( argc < 5 ) - { - std::cout << "Wrong parameter list, the program will now terminate \n"; - return 1; - } - - size_t size_of_grid = (size_t)atoi( argv[1] ); - double min_ = atof( argv[2] ); - double max_ = atof( argv[3] ); - size_t stdiv = atof( argv[4] ); - - std::vector< const char* > filenames; - for ( int i = 5 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - - - - std::cout << "Creating persistence heat maps...\n"; - std::vector< std::vector > filter = create_Gaussian_filter(stdiv,1); - - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; - Persistence_heat_maps l( filenames[i] , filter, distance_from_diagonal, false , size_of_grid , min_ , max_ ); - - std::stringstream ss; - ss << filenames[i] << ".mps"; - l.print_to_file( ss.str().c_str() ); - } - std::cout << "Done \n"; - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp b/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp deleted file mode 100644 index eac0d067..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp +++ /dev/null @@ -1,79 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - - -int main( int argc , char** argv ) -{ - std::cout << "This program creates persistence heat map of diagrams provided as an input. The Gaussian kernels are weighted by the square of distance of a center from the diagonal.\n"; - std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; - std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n"; - std::cerr << "The fourth parameter is an integer, the standard deviation of a gaussian kernel expressed in a number of pixels \n"; - std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; - - if ( argc < 5 ) - { - std::cout << "Wrong parameter list, the program will now terminate \n"; - return 1; - } - - size_t size_of_grid = (size_t)atoi( argv[1] ); - double min_ = atof( argv[2] ); - double max_ = atof( argv[3] ); - size_t stdiv = atof( argv[4] ); - - std::vector< const char* > filenames; - for ( int i = 5 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - - - - std::cout << "Creating persistence heat maps...\n"; - std::vector< std::vector > filter = create_Gaussian_filter(stdiv,1); - - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; - Persistence_heat_maps l( filenames[i] , filter, squared_distance_from_diagonal, false , size_of_grid , min_ , max_ ); - - std::stringstream ss; - ss << filenames[i] << ".mps"; - l.print_to_file( ss.str().c_str() ); - } - std::cout << "Done \n"; - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_pssk.cpp b/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_pssk.cpp deleted file mode 100644 index ccd884ec..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_pssk.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): Pawel Dlotko - * - * Copyright (C) 2015 INRIA Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - - -int main( int argc , char** argv ) -{ - std::cout << "This program creates PSSK of diagrams provided as an input.\n"; - std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; - std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n"; - std::cerr << "The fourth parameter is an integer, the standard deviation of a gaussian kernel expressed in a number of pixels \n"; - std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; - - if ( argc < 5 ) - { - std::cout << "Wrong parameter list, the program will now terminate \n"; - return 1; - } - - size_t size_of_grid = (size_t)atoi( argv[1] ); - double min_ = atof( argv[2] ); - double max_ = atof( argv[3] ); - size_t stdiv = atof( argv[4] ); - - std::vector< const char* > filenames; - for ( int i = 5 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - - std::cout << "Creating persistence heat maps...\n"; - std::vector< std::vector > filter = create_Gaussian_filter(stdiv,1); - - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; - PSSK l( filenames[i] , filter , size_of_grid , min_ , max_ ); - - std::stringstream ss; - ss << filenames[i] << ".pssk"; - l.print_to_file( ss.str().c_str() ); - } - std::cout << "Done \n"; - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp b/src/Gudhi_stat/example/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp deleted file mode 100644 index b85a502b..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp +++ /dev/null @@ -1,44 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program plot persistence landscape stored in a file (the file needs to be created beforehand). Please call the code with the name of a landsape file \n"; - Persistence_heat_maps l; - l.load_from_file( argv[1] ); - l.plot( argv[1] ); - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/aaa b/src/Gudhi_stat/example/utilities/persistence_intervals/aaa deleted file mode 100644 index 5aed2ec0..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_intervals/aaa +++ /dev/null @@ -1,51 +0,0 @@ -0.254583 0.837489 -0.25491 0.410985 -0.262238 0.405964 -0.233498 0.338685 -0.253282 0.344571 -0.249923 0.339748 -0.179532 0.263873 -0.247402 0.323782 -0.181315 0.249492 -0.160746 0.22547 -0.170367 0.232149 -0.192048 0.253065 -0.27298 0.333994 -0.202383 0.260308 -0.278325 0.329157 -0.176624 0.226215 -0.200184 0.249281 -0.275607 0.323516 -0.178408 0.224032 -0.319435 0.362706 -0.184347 0.226301 -0.19342 0.23356 -0.143554 0.180648 -0.313975 0.34917 -0.260887 0.29465 -0.206395 0.23344 -0.272846 0.298156 -0.222294 0.246925 -0.272951 0.295696 -0.235421 0.257957 -0.277907 0.29913 -0.16591 0.186925 -0.223042 0.243167 -0.435025 0.454885 -0.151992 0.169807 -0.138011 0.155776 -0.218083 0.235837 -0.219364 0.237079 -0.297063 0.313899 -0.282666 0.298727 -0.24199 0.256381 -0.302722 0.316677 -0.160453 0.174076 -0.157689 0.169984 -0.192957 0.204705 -0.153738 0.165306 -0.226448 0.237898 -0.243627 0.252613 -0.210126 0.21907 -0.172082 0.177708 -0.232291 0.234521 diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/aaa_Gnuplot_script b/src/Gudhi_stat/example/utilities/persistence_intervals/aaa_Gnuplot_script deleted file mode 100644 index 3ff83e9c..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_intervals/aaa_Gnuplot_script +++ /dev/null @@ -1,208 +0,0 @@ -set xrange [0.131016 : 0.844554] -set yrange [0 : 16.16] -plot '-' using 1:2 notitle with lp -0.138011 0 -0.138011 1 -0.143554 1 -0.143554 2 -0.151992 2 -0.151992 3 -0.153738 3 -0.153738 4 -0.155776 4 -0.155776 3 -0.157689 3 -0.157689 4 -0.160453 4 -0.160453 5 -0.160746 5 -0.160746 6 -0.165306 6 -0.165306 5 -0.16591 5 -0.16591 6 -0.169807 6 -0.169807 5 -0.169984 5 -0.169984 4 -0.170367 4 -0.170367 5 -0.172082 5 -0.172082 6 -0.174076 6 -0.174076 5 -0.176624 5 -0.176624 6 -0.177708 6 -0.177708 5 -0.178408 5 -0.178408 6 -0.179532 6 -0.179532 7 -0.180648 7 -0.180648 6 -0.181315 6 -0.181315 7 -0.184347 7 -0.184347 8 -0.186925 8 -0.186925 7 -0.192048 7 -0.192048 8 -0.192957 8 -0.192957 9 -0.19342 9 -0.19342 10 -0.200184 10 -0.200184 11 -0.202383 11 -0.202383 12 -0.204705 12 -0.204705 11 -0.206395 11 -0.206395 12 -0.210126 12 -0.210126 13 -0.218083 13 -0.218083 14 -0.21907 14 -0.21907 13 -0.219364 13 -0.219364 14 -0.222294 14 -0.222294 15 -0.223042 15 -0.223042 16 -0.224032 16 -0.224032 15 -0.22547 15 -0.22547 14 -0.226215 14 -0.226215 13 -0.226301 13 -0.226301 12 -0.226448 12 -0.226448 13 -0.232149 13 -0.232149 12 -0.232291 12 -0.232291 13 -0.23344 13 -0.23344 12 -0.233498 12 -0.233498 13 -0.23356 13 -0.23356 12 -0.234521 12 -0.234521 11 -0.235421 11 -0.235421 12 -0.235837 12 -0.235837 11 -0.237079 11 -0.237079 10 -0.237898 10 -0.237898 9 -0.24199 9 -0.24199 10 -0.243167 10 -0.243167 9 -0.243627 9 -0.243627 10 -0.246925 10 -0.246925 9 -0.247402 9 -0.247402 10 -0.249281 10 -0.249281 9 -0.249492 9 -0.249492 8 -0.249923 8 -0.249923 9 -0.252613 9 -0.252613 8 -0.253065 8 -0.253065 7 -0.253282 7 -0.253282 8 -0.254583 8 -0.254583 9 -0.25491 9 -0.25491 10 -0.256381 10 -0.256381 9 -0.257957 9 -0.257957 8 -0.260308 8 -0.260308 7 -0.260887 7 -0.260887 8 -0.262238 8 -0.262238 9 -0.263873 9 -0.263873 8 -0.272846 8 -0.272846 9 -0.272951 9 -0.272951 10 -0.27298 10 -0.27298 11 -0.275607 11 -0.275607 12 -0.277907 12 -0.277907 13 -0.278325 13 -0.278325 14 -0.282666 14 -0.282666 15 -0.29465 15 -0.29465 14 -0.295696 14 -0.295696 13 -0.297063 13 -0.297063 14 -0.298156 14 -0.298156 13 -0.298727 13 -0.298727 12 -0.29913 12 -0.29913 11 -0.302722 11 -0.302722 12 -0.313899 12 -0.313899 11 -0.313975 11 -0.313975 12 -0.316677 12 -0.316677 11 -0.319435 11 -0.319435 12 -0.323516 12 -0.323516 11 -0.323782 11 -0.323782 10 -0.329157 10 -0.329157 9 -0.333994 9 -0.333994 8 -0.338685 8 -0.338685 7 -0.339748 7 -0.339748 6 -0.344571 6 -0.344571 5 -0.34917 5 -0.34917 4 -0.362706 4 -0.362706 3 -0.405964 3 -0.405964 2 -0.410985 2 -0.410985 1 -0.435025 1 -0.435025 2 -0.454885 2 -0.454885 1 -0.837489 1 -0.837489 0 - diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp b/src/Gudhi_stat/example/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp deleted file mode 100644 index dba0984a..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp +++ /dev/null @@ -1,72 +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 Sophia-Saclay (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 - -#include -#include -#include - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -using namespace std; - - -int main( int argc , char** argv ) -{ - //std::cout << "This program compute minimum birth and the maximum death time for a collection of persistence intervals \n"; - //if ( argc != 2 ) - //{ - // 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 min_max_ = p.min_max(); - //cout << "Birth-death range : min: " << min_max_.first << ", max: " << min_max_.second << endl; - - std::vector< const char* > filenames; - for ( int i = 1 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - - double min_ = std::numeric_limits::max(); - double max_ = -std::numeric_limits::max(); - - for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) - { - std::cout << "Creating diagram based on a file : " << filenames[file_no] << std::endl; - Persistence_intervals p( filenames[file_no] ); - std::pair min_max_ = p.min_max(); - if ( min_max_.first < min_ )min_ = min_max_.first; - if ( min_max_.second > max_ )max_ = min_max_.second; - } - cout << "Birth-death range : min: " << min_ << ", max: " << max_ << endl; - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp b/src/Gudhi_stat/example/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp deleted file mode 100644 index 6e6a9c88..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp +++ /dev/null @@ -1,57 +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 Sophia-Saclay (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 - -#include - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -using namespace std; - - -int main( int argc , char** argv ) -{ - std::cout << "This program compute the dominant intervals. A number of intervals to be displayed is a parameter of this program. \n"; - if ( argc != 3 ) - { - cout << "To run this program, please provide the name of a file with persistence diagram and number of dominant intervals you would like to get \n"; - return 1; - } - - Persistence_intervals p( argv[1] ); - std::vector< std::pair > dominant_intervals = p.dominant_intervals( atoi( argv[2] ) ); - cout << "Here are the dominant intervals : " << endl; - for ( size_t i = 0 ; i != dominant_intervals.size() ; ++i ) - { - cout << " " << dominant_intervals[i].first<< "," << dominant_intervals[i].second << " "<< endl; - } - - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp b/src/Gudhi_stat/example/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp deleted file mode 100644 index dd2f3f99..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.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): Pawel Dlotko - * - * Copyright (C) 2015 INRIA Sophia-Saclay (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 - -#include - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -using namespace std; - - -int main( int argc , char** argv ) -{ - std::cout << "This program compute a histogram of barcode's length. A number of bins in the histogram is a parameter of this program. \n"; - if ( argc != 3 ) - { - cout << "To run this program, please provide the name of a file with persistence diagram and number of dominant intervals you would like to get \n"; - return 1; - } - - Persistence_intervals p( argv[1] ); - std::vector< std::pair > dominant_intervals = p.dominant_intervals( atoi( argv[2] ) ); - std::vector< size_t > histogram = p.histograms_of_lengths( 10 ); - - std::stringstream gnuplot_script; - gnuplot_script << argv[1] << "_Gnuplot_script"; - ofstream out; - out.open( gnuplot_script.str().c_str() ); - - out << "set style data histogram" << std::endl; - out << "set style histogram cluster gap 1" << std::endl; - out << "set style fill solid border -1" << std::endl; - out << "plot '-' notitle" << std::endl; - for ( size_t i = 0 ; i != histogram.size() ; ++i ) - { - out << histogram[i] << std::endl; - } - out << endl; - std::cout << "To vizualize, open gnuplot and type: load \'" << gnuplot_script.str().c_str() << "\'" << std::endl; - out.close(); - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp b/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp deleted file mode 100644 index 33ff7bce..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp +++ /dev/null @@ -1,93 +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 Sophia-Saclay (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 - -#include - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -using namespace std; - - -int main( int argc , char** argv ) -{ - std::cout << "This program compute a plot of persistence Betti numbers. The input parameter is a file with persistence intervals. \n"; - if ( argc != 2 ) - { - cout << "To run this program, please provide the name of a file with persistence diagram and number of dominant intervals you would like to get \n"; - return 1; - } - - - - std::stringstream gnuplot_script; - gnuplot_script << argv[1] << "_Gnuplot_script"; - ofstream out; - out.open( gnuplot_script.str().c_str() ); - - Persistence_intervals p( argv[1] ); - std::vector< std::pair< double , size_t > > pbns = p.compute_persistent_betti_numbers(); - - //set up the ranges so that we see the image well. - double xRangeBegin = pbns[0].first; - double xRangeEnd = pbns[ pbns.size()-1 ].first; - double yRangeBegin = 0; - double yRangeEnd = 0; - for ( size_t i = 0 ; i != pbns.size() ; ++i ) - { - if ( pbns[i].second > yRangeEnd )yRangeEnd = pbns[i].second; - } - xRangeBegin -= (xRangeEnd -xRangeBegin)/100.0; - xRangeEnd += (xRangeEnd -xRangeBegin)/100.0; - yRangeEnd += yRangeEnd/100; - - - out << "set xrange [" << xRangeBegin << " : " << xRangeEnd << "]" << endl; - out << "set yrange [" << yRangeBegin << " : " << yRangeEnd << "]" << endl; - out << "plot '-' using 1:2 notitle with lp " << std::endl; - double previous_y = 0; - for ( size_t i = 0 ; i != pbns.size() ; ++i ) - { - out << pbns[i].first << " " << previous_y << endl; - out << pbns[i].first << " " << pbns[i].second << std::endl; - previous_y = pbns[i].second; - } - out << endl; - out.close(); - - //for ( size_t i = 0 ; i != pbns.size() ; ++i ) - //{ - // cout << pbns[i].first << " " << pbns[i].second << std::endl; - //} - - std::cout << "To vizualize, open gnuplot and type: load \'" << gnuplot_script.str().c_str() << "\'" << std::endl; - - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_intervals.cpp b/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_intervals.cpp deleted file mode 100644 index c4dd7284..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_intervals.cpp +++ /dev/null @@ -1,59 +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 Sophia-Saclay (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 - -#include - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - - -double epsilon = 0.0000005; - -using namespace std; - - -int main( int argc , char** argv ) -{ - if ( argc != 2 ) - { - cout << "To run this program, please provide the name of a file with persistence diagram \n"; - return 1; - } - Persistence_intervals b( argv[1] ); - b.plot( argv[1] ); - return 0; -} - - - - - - - diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes/average_landscapes.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes/average_landscapes.cpp deleted file mode 100644 index 418244d2..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_landscapes/average_landscapes.cpp +++ /dev/null @@ -1,75 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program computes average persistence landscape of persistence landscapes created based on persistence diagrams provided as an input (you must create them first).\n"; - std::cout << "Please call this program with the names of files with persistence landscapes. The program will create a persistence landscape which will be their average \n"; - std::vector< const char* > filenames; - - if ( argc == 1 ) - { - std::cout << "No input files given, the program will now terminate \n"; - return 1; - } - - for ( int i = 1 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - - std::cout << "Creating persistence landscapes...\n"; - std::vector< Abs_Topological_data_with_averages* > lands; - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - Persistence_landscape* l = new Persistence_landscape; - l->load_landscape_from_file( filenames[i] ); - lands.push_back( (Abs_Topological_data_with_averages*)l ); - } - - Persistence_landscape av; - av.compute_average( lands ); - - av.print_to_file( "average.land" ); - - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - delete lands[i]; - } - - std::cout << "Done \n"; - - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp deleted file mode 100644 index 12a4b3bd..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp +++ /dev/null @@ -1,109 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program compute distance of persistence landscapes stored in a file (the file needs to be created beforehand). \n"; - std::cout << "The first parameter of a program is an interger p. The program compute L^p distance of the given landscapes. For L^infty distance choose p = -1. \n"; - std::cout << "The remaining parameters of this programs are names of files with persistence landscapes."; - - if ( argc < 3 ) - { - std::cout << "Wrong number of parameters, the program will now terminate \n"; - return 1; - } - - int p = atoi( argv[1] ); - - std::vector< const char* > filenames; - for ( int i = 2 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - std::vector< Persistence_landscape > landscaspes; - landscaspes.reserve( filenames.size() ); - for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) - { - std::cout << "Loading persistence landscape from a file : " << filenames[file_no] << std::endl; - Persistence_landscape l; - l.load_landscape_from_file( filenames[file_no] ); - landscaspes.push_back( l ); - } - - //and now we will compute the scalar product of landscapes. - - //first we prepare an array: - std::vector< std::vector< double > > distance( filenames.size() ); - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - std::vector< double > v( filenames.size() , 0 ); - distance[i] = v; - } - - //and now we can compute the distances: - for ( size_t i = 0 ; i != landscaspes.size() ; ++i ) - { - for ( size_t j = i ; j != landscaspes.size() ; ++j ) - { - distance[i][j] = distance[j][i] = compute_discance_of_landscapes( landscaspes[i], landscaspes[j] , p ) ; - - } - } - - //and now output the result to the screen and a file: - ofstream out; - out.open( "distance" ); - for ( size_t i = 0 ; i != distance.size() ; ++i ) - { - for ( size_t j = 0 ; j != distance.size() ; ++j ) - { - cout << distance[i][j] << " "; - out << distance[i][j] << " "; - } - cout << endl; - out << endl; - } - out.close(); - - return 0; -} - - - - - - - diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp deleted file mode 100644 index ac64a798..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp +++ /dev/null @@ -1,92 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program compute scalar product of persistence landscapes stored in a file (the file needs to be created beforehand). \n"; - std::cout << "The parameters of this programs are names of files with persistence landscapes.\n"; - - std::vector< const char* > filenames; - for ( int i = 1 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - std::vector< Persistence_landscape > landscaspes; - landscaspes.reserve( filenames.size() ); - for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) - { - std::cout << "Reading persistence landscape from a file : " << filenames[file_no] << std::endl; - Persistence_landscape l; - l.load_landscape_from_file( filenames[file_no] ); - landscaspes.push_back( l ); - } - - //and now we will compute the scalar product of landscapes. - - //first we prepare an array: - std::vector< std::vector< double > > scalar_product( filenames.size() ); - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - std::vector< double > v( filenames.size() , 0 ); - scalar_product[i] = v; - } - - //and now we can compute the scalar product: - for ( size_t i = 0 ; i != landscaspes.size() ; ++i ) - { - for ( size_t j = i ; j != landscaspes.size() ; ++j ) - { - scalar_product[i][j] = scalar_product[j][i] = compute_inner_product( landscaspes[i], landscaspes[j] ) ; - } - } - - //and now output the result to the screen and a file: - ofstream out; - out.open( "scalar_product" ); - for ( size_t i = 0 ; i != scalar_product.size() ; ++i ) - { - for ( size_t j = 0 ; j != scalar_product.size() ; ++j ) - { - cout << scalar_product[i][j] << " "; - out << scalar_product[i][j] << " "; - } - cout << endl; - out << endl; - } - out.close(); - - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes/create_landscapes.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes/create_landscapes.cpp deleted file mode 100644 index 5152a033..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_landscapes/create_landscapes.cpp +++ /dev/null @@ -1,56 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program creates persistence landscapes of diagrams provided as an input. Please call this program with the names of files with persistence diagrams \n"; - std::vector< const char* > filenames; - for ( int i = 1 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - - std::cout << "Creating persistence landscapes...\n"; - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - Persistence_landscape l( filenames[i] , 1 ); - std::stringstream ss; - ss << filenames[i] << ".land"; - l.print_to_file( ss.str().c_str() ); - } - std::cout << "Done \n"; - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes/plot_landscapes.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes/plot_landscapes.cpp deleted file mode 100644 index 559fc096..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_landscapes/plot_landscapes.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. - * - * Author(s): Pawel Dlotko - * - * Copyright (C) 2015 INRIA Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program plot persistence landscape stored in a file (the file needs to be created beforehand). Please call the code with the name of a landsape file \n"; - Persistence_landscape l; - l.load_landscape_from_file( argv[1] ); - - std::stringstream ss; - ss << argv[1] << "_gnuplot_script"; - l.plot( ss.str().c_str() ); - - std::cout << "Done \n"; - - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp deleted file mode 100644 index 7c3b8db2..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.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) 2015 INRIA Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program computes average persistence landscape on grid of persistence landscapes on grid created based on persistence diagrams provided as an input. Please call this program with the names of files with persistence diagrams \n"; - std::vector< const char* > filenames; - - if ( argc == 1 ) - { - std::cout << "No input files given, the program will now terminate \n"; - return 1; - } - - for ( int i = 1 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - - std::cout << "Creating persistence landscapes...\n"; - std::vector< Abs_Topological_data_with_averages* > lands; - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - Persistence_landscape_on_grid* l = new Persistence_landscape_on_grid; - l->load_landscape_from_file( filenames[i] ); - lands.push_back( (Abs_Topological_data_with_averages*)l ); - } - - Persistence_landscape_on_grid av; - av.compute_average( lands ); - - av.print_to_file( "average.g_land" ); - - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - delete lands[i]; - } - - std::cout << "Done \n"; - - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp deleted file mode 100644 index 20cb52c9..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp +++ /dev/null @@ -1,107 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program compute dsitance of persistence landscapes on grid stored in a file (the file needs to be created beforehand). \n"; - std::cout << "The first parameter of a program is an interger p. The program compute L^p distance of the the landscapes on grid. For L^infty distance choose p = -1. \n"; - std::cout << "The remaining parameters of this programs are names of files with persistence landscapes on grid.\n"; - - if ( argc < 3 ) - { - std::cout << "Wrong number of parameters, the program will now terminate \n"; - return 1; - } - - int p = atoi( argv[1] ); - - std::vector< const char* > filenames; - for ( int i = 2 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - std::vector< Persistence_landscape_on_grid > landscaspes; - landscaspes.reserve( filenames.size() ); - for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) - { - Persistence_landscape_on_grid l; - l.load_landscape_from_file( filenames[file_no] ); - landscaspes.push_back( l ); - } - - //and now we will compute the scalar product of landscapes. - - //first we prepare an array: - std::vector< std::vector< double > > distance( filenames.size() ); - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - std::vector< double > v( filenames.size() , 0 ); - distance[i] = v; - } - - //and now we can compute the scalar product: - for ( size_t i = 0 ; i != landscaspes.size() ; ++i ) - { - for ( size_t j = i ; j != landscaspes.size() ; ++j ) - { - distance[i][j] = distance[j][i] = compute_discance_of_landscapes_on_grid( landscaspes[i], landscaspes[j] , p ) ; - } - } - - //and now output the result to the screen and a file: - ofstream out; - out.open( "distance" ); - for ( size_t i = 0 ; i != distance.size() ; ++i ) - { - for ( size_t j = 0 ; j != distance.size() ; ++j ) - { - cout << distance[i][j] << " "; - out << distance[i][j] << " "; - } - cout << endl; - out << endl; - } - out.close(); - - return 0; -} - - - - - - - diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp deleted file mode 100644 index 056710ff..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp +++ /dev/null @@ -1,91 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program compute scalar product of persistence landscapes on grid stored in a file (the file needs to be created beforehand). \n"; - std::cout << "The parameters of this programs are names of files with persistence landscapes on grid.\n"; - - std::vector< const char* > filenames; - for ( int i = 1 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - std::vector< Persistence_landscape_on_grid > landscaspes; - landscaspes.reserve( filenames.size() ); - for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) - { - Persistence_landscape_on_grid l; - l.load_landscape_from_file( filenames[file_no] ); - landscaspes.push_back( l ); - } - - //and now we will compute the scalar product of landscapes. - - //first we prepare an array: - std::vector< std::vector< double > > scalar_product( filenames.size() ); - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - std::vector< double > v( filenames.size() , 0 ); - scalar_product[i] = v; - } - - //and now we can compute the scalar product: - for ( size_t i = 0 ; i != landscaspes.size() ; ++i ) - { - for ( size_t j = i ; j != landscaspes.size() ; ++j ) - { - scalar_product[i][j] = scalar_product[j][i] = compute_inner_product( landscaspes[i], landscaspes[j] ) ; - } - } - - //and now output the result to the screen and a file: - ofstream out; - out.open( "scalar_product" ); - for ( size_t i = 0 ; i != scalar_product.size() ; ++i ) - { - for ( size_t j = 0 ; j != scalar_product.size() ; ++j ) - { - cout << scalar_product[i][j] << " "; - out << scalar_product[i][j] << " "; - } - cout << endl; - out << endl; - } - out.close(); - - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp deleted file mode 100644 index 2ac74eb3..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.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) 2015 INRIA Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program creates persistence landscape on grid of diagrams provided as an input.\n"; - std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; - std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n"; - std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; - - if ( argc < 4 ) - { - std::cout << "Wrong parameter list, the program will now terminate \n"; - return 1; - } - - size_t size_of_grid = (size_t)atoi( argv[1] ); - double min_ = atof( argv[2] ); - double max_ = atof( argv[3] ); - - std::vector< const char* > filenames; - for ( int i = 4 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - - std::cout << "Creating persistence landscapes...\n"; - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - std::cout << "Creating persistence landscape on a grid based on a file : " << filenames[i] << std::endl; - Persistence_landscape_on_grid l; - if ( (min_ != -1) || (max_ != -1) ) - { - l = Persistence_landscape_on_grid( filenames[i] , min_ , max_ , size_of_grid ); - } - else - { - //(min_ == -1) && (max_ == -1), in this case the program will find min_ and max_ based on the data. - l = Persistence_landscape_on_grid( filenames[i] , size_of_grid ); - } - std::stringstream ss; - ss << filenames[i] << ".g_land"; - l.print_to_file( ss.str().c_str() ); - } - std::cout << "Done \n"; - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp deleted file mode 100644 index 54b8367b..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp +++ /dev/null @@ -1,55 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program plot persistence landscape on grid stored in a file (the file needs to be created beforehand). Please call the code with the name of a landsape on grid file \n"; - if ( argc == 1 ) - { - std::cout << "Wrong parameters of a program call, the program will now terminate \n"; - return 1; - } - Persistence_landscape_on_grid l; - l.load_landscape_from_file( argv[1] ); - - std::stringstream ss; - ss << argv[1] << "_gnuplot_script"; - l.plot( ss.str().c_str() ); - - std::cout << "Done \n"; - - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_vectors/average_persistence_vectors.cpp b/src/Gudhi_stat/example/utilities/persistence_vectors/average_persistence_vectors.cpp deleted file mode 100644 index 1b269e9c..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_vectors/average_persistence_vectors.cpp +++ /dev/null @@ -1,75 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program computes average persistence vector of persistence vectors created based on persistence diagrams provided as an input. \n"; - std::cout << "Please call this program with the names of files with persistence diagrams \n"; - std::vector< const char* > filenames; - - if ( argc == 1 ) - { - std::cout << "No input files given, the program will now terminate \n"; - return 1; - } - - for ( int i = 1 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - - std::cout << "Reading persistence vectors...\n"; - std::vector< Abs_Topological_data_with_averages* > lands; - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - Vector_distances_in_diagram< euclidean_distance >* l = new Vector_distances_in_diagram< euclidean_distance >; - l->load_from_file( filenames[i] ); - lands.push_back( (Abs_Topological_data_with_averages*)l ); - } - - Vector_distances_in_diagram< euclidean_distance > av; - av.compute_average( lands ); - - av.print_to_file( "average.vect" ); - - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - delete lands[i]; - } - - std::cout << "Done \n"; - - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp b/src/Gudhi_stat/example/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp deleted file mode 100644 index 72026497..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp +++ /dev/null @@ -1,108 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program compute distance of persistence vectors stored in a file (the file needs to be created beforehand). \n"; - std::cout << "The first parameter of a program is an interger p. The program compute l^p distance of the vectors. For l^infty distance choose p = -1. \n"; - std::cout << "The remaining parameters of this programs are names of files with persistence vectors.\n"; - - if ( argc < 3 ) - { - std::cout << "Wrong number of parameters, the program will now terminate \n"; - return 1; - } - - int p = atoi( argv[1] ); - - std::vector< const char* > filenames; - for ( int i = 2 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - std::vector< Vector_distances_in_diagram< euclidean_distance >* > vectors; - vectors.reserve( filenames.size() ); - for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) - { - //cerr << filenames[file_no] << endl; - Vector_distances_in_diagram< euclidean_distance >* l = new Vector_distances_in_diagram< euclidean_distance >; - l->load_from_file( filenames[file_no] ); - vectors.push_back( l ); - } - - //and now we will compute the scalar product of landscapes. - - //first we prepare an array: - std::vector< std::vector< double > > distance( filenames.size() ); - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - std::vector< double > v( filenames.size() , 0 ); - distance[i] = v; - } - - //and now we can compute the distances: - for ( size_t i = 0 ; i != vectors.size() ; ++i ) - { - for ( size_t j = i+1 ; j != vectors.size() ; ++j ) - { - distance[i][j] = distance[j][i] = ((Vector_distances_in_diagram< euclidean_distance >*)vectors[i])->distance( vectors[j] , p ) ; - } - } - - //and now output the result to the screen and a file: - ofstream out; - out.open( "distance" ); - for ( size_t i = 0 ; i != distance.size() ; ++i ) - { - for ( size_t j = 0 ; j != distance.size() ; ++j ) - { - cout << distance[i][j] << " "; - out << distance[i][j] << " "; - } - cout << endl; - out << endl; - } - out.close(); - - return 0; -} - - - - - - - diff --git a/src/Gudhi_stat/example/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp b/src/Gudhi_stat/example/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp deleted file mode 100644 index 16192d52..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp +++ /dev/null @@ -1,97 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program compute scalar product of persistence vectors stored in a file (the file needs to be created beforehand). \n"; - std::cout << "The parameters of this programs are names of files with persistence vectors.\n"; - - std::vector< const char* > filenames; - for ( int i = 1 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - std::vector< Vector_distances_in_diagram< euclidean_distance >* > vectors; - vectors.reserve( filenames.size() ); - for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) - { - Vector_distances_in_diagram< euclidean_distance >* l = new Vector_distances_in_diagram< euclidean_distance >; - l->load_from_file( filenames[file_no] ); - vectors.push_back( l ); - } - - //and now we will compute the scalar product of landscapes. - - //first we prepare an array: - std::vector< std::vector< double > > scalar_product( filenames.size() ); - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - std::vector< double > v( filenames.size() , 0 ); - scalar_product[i] = v; - } - - //and now we can compute the scalar product: - for ( size_t i = 0 ; i != vectors.size() ; ++i ) - { - for ( size_t j = i ; j != vectors.size() ; ++j ) - { - scalar_product[i][j] = scalar_product[j][i] = ((Vector_distances_in_diagram< euclidean_distance >*)vectors[i])->compute_scalar_product( vectors[j] ) ; - } - } - - //and now output the result to the screen and a file: - ofstream out; - out.open( "scalar_product" ); - for ( size_t i = 0 ; i != scalar_product.size() ; ++i ) - { - for ( size_t j = 0 ; j != scalar_product.size() ; ++j ) - { - cout << scalar_product[i][j] << " "; - out << scalar_product[i][j] << " "; - } - cout << endl; - out << endl; - } - out.close(); - - //cleaning up - for ( size_t i = 0 ; i != vectors.size() ; ++i ) - { - delete vectors[i]; - } - - return 0; -} diff --git a/src/Gudhi_stat/example/utilities/persistence_vectors/create_persistence_vectors.cpp b/src/Gudhi_stat/example/utilities/persistence_vectors/create_persistence_vectors.cpp deleted file mode 100644 index 99015e41..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_vectors/create_persistence_vectors.cpp +++ /dev/null @@ -1,57 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program creates persistence vectors of diagrams provided as an input. Please call this program with the names of files with persistence diagrams \n"; - std::vector< const char* > filenames; - for ( int i = 1 ; i < argc ; ++i ) - { - filenames.push_back( argv[i] ); - } - - for ( size_t i = 0 ; i != filenames.size() ; ++i ) - { - std::cerr << "Creatign persistence vectors based on a file : " << filenames[i] << std::endl; - Vector_distances_in_diagram< euclidean_distance > l( filenames[i] , -1 ); - std::stringstream ss; - ss << filenames[i] << ".vect"; - l.print_to_file( ss.str().c_str() ); - } - std::cout << "Done \n"; - return 0; -} - diff --git a/src/Gudhi_stat/example/utilities/persistence_vectors/plot_persistence_vectors.cpp b/src/Gudhi_stat/example/utilities/persistence_vectors/plot_persistence_vectors.cpp deleted file mode 100644 index ad6c06e2..00000000 --- a/src/Gudhi_stat/example/utilities/persistence_vectors/plot_persistence_vectors.cpp +++ /dev/null @@ -1,51 +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 Sophia-Saclay (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 - - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - -#include -#include - - -int main( int argc , char** argv ) -{ - std::cout << "This program create a Gnuplot script to plot persistence vector. Please call this program with the name of file with persistence vector. \n"; - if ( argc != 2 ) - { - std::cout << "Wrong number of parameters, the program will now terminate. \n"; - return 1; - } - Vector_distances_in_diagram< euclidean_distance > l; - l.load_from_file( argv[1] ); - l.plot( argv[1] ); - - return 0; -} - diff --git a/src/Gudhi_stat/example/vector_representation.cpp b/src/Gudhi_stat/example/vector_representation.cpp index 358de1b0..0581baf4 100644 --- a/src/Gudhi_stat/example/vector_representation.cpp +++ b/src/Gudhi_stat/example/vector_representation.cpp @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 diff --git a/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Real_valued_topological_data.h b/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Real_valued_topological_data.h index 9b313e62..09c2cf85 100644 --- a/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Real_valued_topological_data.h +++ b/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Real_valued_topological_data.h @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 diff --git a/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Topological_data.h b/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Topological_data.h index 0e3db722..e38ae2df 100644 --- a/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Topological_data.h +++ b/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Topological_data.h @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 @@ -20,10 +20,10 @@ * along with this program. If not, see . */ -//#ifndef ABS_Topological_data_H_ -//#define ABS_Topological_data_H_ +#ifndef ABS_Topological_data_H_ +#define ABS_Topological_data_H_ + -#pragma once namespace Gudhi { @@ -44,4 +44,4 @@ class Abs_Topological_data }//namespace Gudhi_stat }//namespace Gudhi -//#endif +#endif diff --git a/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Topological_data_with_averages.h b/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Topological_data_with_averages.h index 88220e73..8585a62c 100644 --- a/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Topological_data_with_averages.h +++ b/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Topological_data_with_averages.h @@ -5,7 +5,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 @@ -23,14 +23,13 @@ #ifndef Abs_Topological_data_with_averages_H_ #define Abs_Topological_data_with_averages_H_ +#include + namespace Gudhi { namespace Gudhi_stat { - -#include - /** * This is an abstract container to store topological information. Most typically, this information will be some representation of persistent homology. @@ -46,7 +45,7 @@ public: //2) Function returns Abs_Topological_data*, and compute the average of all the objects in the vector, plus (*this). //virtual Abs_Topological_data* compute_average( std::vector< Abs_Topological_data_with_averages* > to_average ) = 0; //At the moment I will try to implement option (1). - virtual void compute_average( std::vector< Abs_Topological_data_with_averages* > to_average ) = 0; + virtual void compute_average( const std::vector< Abs_Topological_data_with_averages* >& to_average ) = 0; virtual ~Abs_Topological_data_with_averages(){} protected: }; diff --git a/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Topological_data_with_distances.h b/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Topological_data_with_distances.h index 2725c2c6..5b683268 100644 --- a/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Topological_data_with_distances.h +++ b/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Topological_data_with_distances.h @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 @@ -23,14 +23,15 @@ #ifndef Abs_Topological_data_with_distances_H_ #define Abs_Topological_data_with_distances_H_ +//#include "Abs_Topological_data.h" +#include + + namespace Gudhi { namespace Gudhi_stat { -//with this path it do not find the files -//#include -#include "Abs_Topological_data.h" /** * This is an abstract container to store topological information. Most typically, this information will be some representation of persistent homology. diff --git a/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Topological_data_with_scalar_product.h b/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Topological_data_with_scalar_product.h index b5e5b175..819b1376 100644 --- a/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Topological_data_with_scalar_product.h +++ b/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Topological_data_with_scalar_product.h @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 @@ -23,13 +23,14 @@ #ifndef Abs_Topological_data_with_scalar_product_H #define Abs_Topological_data_with_scalar_product_H_ +#include + + namespace Gudhi { namespace Gudhi_stat { -#include - /** * This is an abstract container to store topological information. Most typically, this information will be some representation of persistent homology. **/ diff --git a/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Vectorized_topological_data.h b/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Vectorized_topological_data.h index df423688..2f352428 100644 --- a/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Vectorized_topological_data.h +++ b/src/Gudhi_stat/include/gudhi/abstract_classes/Abs_Vectorized_topological_data.h @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 @@ -24,17 +24,13 @@ #define Abs_Vectorized_topological_data_H_ #include +#include "Abs_Topological_data.h" +#include namespace Gudhi { namespace Gudhi_stat { - -//with this path it do not find the files -//#include -#include "Abs_Topological_data.h" -#include - using namespace std; /** diff --git a/src/Gudhi_stat/include/gudhi/concretizations/PSSK.h b/src/Gudhi_stat/include/gudhi/concretizations/PSSK.h index 61597ee2..8168b7a7 100644 --- a/src/Gudhi_stat/include/gudhi/concretizations/PSSK.h +++ b/src/Gudhi_stat/include/gudhi/concretizations/PSSK.h @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 diff --git a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_heat_maps.h b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_heat_maps.h index afb0da87..89254f16 100644 --- a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_heat_maps.h +++ b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_heat_maps.h @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 @@ -19,6 +19,9 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + +#ifndef Persistence_heat_maps_H +#define Persistence_heat_maps_H //standard include #include @@ -36,7 +39,7 @@ #include #include #include -#include +#include @@ -311,7 +314,7 @@ public: std::vector vectorize( int number_of_function ); double distance( const Abs_Topological_data_with_distances* second_ , double power = 1); double project_to_R( int number_of_function ); - void compute_average( std::vector< Abs_Topological_data_with_averages* > to_average ); + void compute_average( const std::vector< Abs_Topological_data_with_averages* >& to_average ); double compute_scalar_product( const Abs_Topological_data_with_scalar_product* second_ ); protected: @@ -740,7 +743,7 @@ double Persistence_heat_maps::project_to_R( int number_of_function ) return result; } -void Persistence_heat_maps::compute_average( std::vector< Abs_Topological_data_with_averages* > to_average ) +void Persistence_heat_maps::compute_average( const std::vector< Abs_Topological_data_with_averages* >& to_average ) { std::vector maps; maps.reserve( to_average.size() ); @@ -779,3 +782,6 @@ double Persistence_heat_maps::compute_scalar_product( const Abs_Topological_data }//namespace Gudhi_stat }//namespace Gudhi + + +#endif diff --git a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_intervals.h b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_intervals.h index e0db0070..f694541b 100644 --- a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_intervals.h +++ b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_intervals.h @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 @@ -517,7 +517,8 @@ std::vector< double > Persistence_intervals::k_n_n( size_t k , size_t where_to_c } std::vector< double > distances_from_diagonal( this->intervals.size() ); std::fill( distances_from_diagonal.begin() , distances_from_diagonal.end() , 0 ); - for ( size_t i = 0 ; i != this->intervals.size() ; ++i ) + + for ( size_t i = 0 ; i != this->intervals.size() ; ++i ) { std::vector< double > distancesFromI; for ( size_t j = i+1 ; j != this->intervals.size() ; ++j ) @@ -602,7 +603,7 @@ std::vector< double > Persistence_intervals::k_n_n( size_t k , size_t where_to_c std::sort( result.begin() , result.end() , std::greater() ); result.resize( std::min( result.size() , where_to_cut ) ); - return result; + return result; } diff --git a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape.h b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape.h index 82ee5878..f5f96d34 100644 --- a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape.h +++ b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape.h @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 @@ -42,7 +42,7 @@ #include #include #include -#include +#include using namespace std; @@ -446,7 +446,7 @@ public: } return v; } - void compute_average( std::vector< Abs_Topological_data_with_averages* > to_average ) + void compute_average( const std::vector< Abs_Topological_data_with_averages* >& to_average ) { bool dbg = false; diff --git a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape_on_grid.h b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape_on_grid.h index 7afd515d..8afab347 100644 --- a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape_on_grid.h +++ b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape_on_grid.h @@ -1,3 +1,25 @@ +/* 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 (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 . + */ + #ifndef Persistence_landscape_on_grid_H_ #define Persistence_landscape_on_grid_H_ @@ -20,6 +42,7 @@ #include #include #include +#include @@ -47,23 +70,6 @@ struct greater bool operator()(T const &a, T const &b) const { return a > b; } }; -//double epsi = std::numeric_limits::epsilon(); -double epsi = 0.000005; - - -/** - * A procedure used to compare doubles. Typically gien two doubles A and B, comparing A == B is not good idea. In this case, we use the procedure almostEqual with the epsi defined at - * the top of the file. Setting up the epsi give the user a tolerance on what should be consider equal. -**/ -inline bool almost_equal( double a , double b ) -{ - if ( fabs(a-b) < epsi ) - return true; - return false; -} - - - class Persistence_landscape_on_grid : public Abs_Vectorized_topological_data , @@ -739,7 +745,7 @@ public: /** * A function to compute averaged persistence landscape on a grid, based on vector of persistence landscapes on grid (projected to Abs_Topological_data_with_averages*, since this is a concretization of a virtual method. **/ - void compute_average( std::vector< Abs_Topological_data_with_averages* > to_average ) + void compute_average( const std::vector< Abs_Topological_data_with_averages* >& to_average ) { bool dbg = false; diff --git a/src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h b/src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h index 5870c652..951d8717 100644 --- a/src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h +++ b/src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 @@ -20,7 +20,7 @@ * along with this program. If not, see . */ -#pragma once + #ifndef Vector_distances_in_diagram_H #define Vector_distances_in_diagram_H @@ -38,7 +38,7 @@ #include #include #include -#include +#include using namespace std; namespace Gudhi @@ -88,7 +88,7 @@ public: /** * The constructor that takes as an input a multiset of persistence intervals (given as vector of birth-death pairs). The second parameter is the desiered length of the output vectors. **/ - Vector_distances_in_diagram( std::vector< std::pair< double , double > > intervals , size_t where_to_cut ); + Vector_distances_in_diagram( const std::vector< std::pair< double , double > >& intervals , size_t where_to_cut ); /** * The constructor taking as an input a file with birth-death pairs. The second parameter is the desiered length of the output vectors. @@ -112,9 +112,9 @@ public: template friend ostream& operator << ( ostream& out , const Vector_distances_in_diagram& d ) { - for ( size_t i = 0 ; i != std::min( d.sorted_vector_of_distnaces.size() , d.where_to_cut) ; ++i ) + for ( size_t i = 0 ; i != std::min( d.sorted_vector_of_distances.size() , d.where_to_cut) ; ++i ) { - out << d.sorted_vector_of_distnaces[i] << " "; + out << d.sorted_vector_of_distances[i] << " "; } return out; } @@ -124,14 +124,14 @@ public: **/ inline double vector_in_position( size_t position ) { - if ( position >= this->sorted_vector_of_distnaces.size() )throw("Wrong position in accessing Vector_distances_in_diagram::sorted_vector_of_distnaces\n"); - return this->sorted_vector_of_distnaces[position]; + if ( position >= this->sorted_vector_of_distances.size() )throw("Wrong position in accessing Vector_distances_in_diagram::sorted_vector_of_distances\n"); + return this->sorted_vector_of_distances[position]; } /** * Return a size of a vector. **/ - inline size_t size()const{return this->sorted_vector_of_distnaces.size();} + inline size_t size()const{return this->sorted_vector_of_distances.size();} /** * Write a vector to a file. @@ -156,10 +156,10 @@ public: **/ bool operator == ( const Vector_distances_in_diagram& second ) { - if ( this->sorted_vector_of_distnaces.size() != second.sorted_vector_of_distnaces.size() )return false; - for ( size_t i = 0 ; i != this->sorted_vector_of_distnaces.size() ; ++i ) + if ( this->sorted_vector_of_distances.size() != second.sorted_vector_of_distances.size() )return false; + for ( size_t i = 0 ; i != this->sorted_vector_of_distances.size() ; ++i ) { - if ( !almost_equal(this->sorted_vector_of_distnaces[i] , second.sorted_vector_of_distnaces[i]) )return false; + if ( !almost_equal(this->sorted_vector_of_distances[i] , second.sorted_vector_of_distances[i]) )return false; } return true; } @@ -183,7 +183,7 @@ public: /** * Compute a average of two persistent vectors. **/ - void compute_average( std::vector< Abs_Topological_data_with_averages* > to_average ); + void compute_average( const std::vector< Abs_Topological_data_with_averages* >& to_average ); /** * Compute a distance of two persistent vectors. @@ -200,7 +200,7 @@ public: **/ std::vector< double > output_for_visualization() { - return this->sorted_vector_of_distnaces; + return this->sorted_vector_of_distances; } /** @@ -216,9 +216,9 @@ public: out << "set style histogram cluster gap 1" << std::endl; out << "set style fill solid border -1" << std::endl; out << "plot '-' notitle" << std::endl; - for ( size_t i = 0 ; i != this->sorted_vector_of_distnaces.size() ; ++i ) + for ( size_t i = 0 ; i != this->sorted_vector_of_distances.size() ; ++i ) { - out << this->sorted_vector_of_distnaces[i] << std::endl; + out << this->sorted_vector_of_distances[i] << std::endl; } out << endl; out.close(); @@ -228,12 +228,12 @@ public: private: std::vector< std::pair< double , double > > intervals; - std::vector< double > sorted_vector_of_distnaces; + std::vector< double > sorted_vector_of_distances; - void compute_sorted_vector_of_distnaces_via_heap( size_t where_to_cut ); - void compute_sorted_vector_of_distnaces_via_vector_sorting( size_t where_to_cut ); + void compute_sorted_vector_of_distances_via_heap( size_t where_to_cut ); + void compute_sorted_vector_of_distances_via_vector_sorting( size_t where_to_cut ); - Vector_distances_in_diagram( const std::vector< double >& sorted_vector_of_distnaces_ ):sorted_vector_of_distnaces(sorted_vector_of_distnaces_) + Vector_distances_in_diagram( const std::vector< double >& sorted_vector_of_distances_ ):sorted_vector_of_distances(sorted_vector_of_distances_) { this->set_up_numbers_of_functions_for_vectorization_and_projections_to_reals(); } @@ -241,19 +241,19 @@ private: void set_up_numbers_of_functions_for_vectorization_and_projections_to_reals() { //warning, this function can be only called after filling in the intervals vector. - this->number_of_functions_for_vectorization = this->sorted_vector_of_distnaces.size(); - this->number_of_functions_for_projections_to_reals = this->sorted_vector_of_distnaces.size(); + this->number_of_functions_for_vectorization = this->sorted_vector_of_distances.size(); + this->number_of_functions_for_projections_to_reals = this->sorted_vector_of_distances.size(); } }; template -Vector_distances_in_diagram::Vector_distances_in_diagram( std::vector< std::pair< double,double > > intervals_ , size_t where_to_cut ):Abs_Vectorized_topological_data(where_to_cut) +Vector_distances_in_diagram::Vector_distances_in_diagram( const std::vector< std::pair< double,double > >& intervals_ , size_t where_to_cut ):Abs_Vectorized_topological_data(where_to_cut) { std::vector< std::pair< double,double > > i( intervals_ ); this->intervals = i; - //this->compute_sorted_vector_of_distnaces_via_heap( where_to_cut ); - this->compute_sorted_vector_of_distnaces_via_vector_sorting(where_to_cut); + //this->compute_sorted_vector_of_distances_via_heap( where_to_cut ); + this->compute_sorted_vector_of_distances_via_vector_sorting(where_to_cut); this->set_up_numbers_of_functions_for_vectorization_and_projections_to_reals(); } @@ -262,8 +262,8 @@ Vector_distances_in_diagram::Vector_distances_in_diagram( const Vector_distan { std::vector< std::pair< double,double > > inter( org.intervals ); this->intervals = inter; - std::vector< double > sorted_vector_of_distnaces( org.sorted_vector_of_distnaces ); - this->sorted_vector_of_distnaces = sorted_vector_of_distnaces; + std::vector< double > sorted_vector_of_distances( org.sorted_vector_of_distances ); + this->sorted_vector_of_distances = sorted_vector_of_distances; set_up_numbers_of_functions_for_vectorization_and_projections_to_reals(); } @@ -273,8 +273,8 @@ Vector_distances_in_diagram& Vector_distances_in_diagram::operator =( cons { std::vector< std::pair< double , double > > inter( org.intervals ); this->intervals = inter; - std::vector< double > sorted_vector_of_distnaces( org.sorted_vector_of_distnaces ); - this->sorted_vector_of_distnaces = sorted_vector_of_distnaces; + std::vector< double > sorted_vector_of_distances( org.sorted_vector_of_distances ); + this->sorted_vector_of_distances = sorted_vector_of_distances; return *this; } @@ -288,13 +288,13 @@ Vector_distances_in_diagram::Vector_distances_in_diagram( const char* filenam //std::vector< std::pair< double , double > > intervals = read_gudhi_file( filename , dimension ); this->intervals = intervals; - this->compute_sorted_vector_of_distnaces_via_heap( where_to_cut ); - //this->compute_sorted_vector_of_distnaces_via_vector_sorting( where_to_cut ); + this->compute_sorted_vector_of_distances_via_heap( where_to_cut ); + //this->compute_sorted_vector_of_distances_via_vector_sorting( where_to_cut ); set_up_numbers_of_functions_for_vectorization_and_projections_to_reals(); } template < typename F> -void Vector_distances_in_diagram::compute_sorted_vector_of_distnaces_via_heap( size_t where_to_cut ) +void Vector_distances_in_diagram::compute_sorted_vector_of_distances_via_heap( size_t where_to_cut ) { bool dbg = false; @@ -387,14 +387,14 @@ void Vector_distances_in_diagram::compute_sorted_vector_of_distnaces_via_heap std::cout << endl; } - this->sorted_vector_of_distnaces = heap; + this->sorted_vector_of_distances = heap; } template < typename F> -void Vector_distances_in_diagram::compute_sorted_vector_of_distnaces_via_vector_sorting( size_t where_to_cut ) +void Vector_distances_in_diagram::compute_sorted_vector_of_distances_via_vector_sorting( size_t where_to_cut ) { std::vector< double > distances; distances.reserve( (size_t)(0.5 * this->intervals.size() * ( this->intervals.size() - 1 ) + this->intervals.size()) ); @@ -421,7 +421,7 @@ void Vector_distances_in_diagram::compute_sorted_vector_of_distnaces_via_vect std::sort( distances.begin() , distances.end() , std::greater() ); if ( distances.size() > where_to_cut )distances.resize( where_to_cut ); - this->sorted_vector_of_distnaces = distances; + this->sorted_vector_of_distances = distances; } @@ -436,13 +436,13 @@ double Vector_distances_in_diagram::project_to_R( int number_of_function ) double result = 0; for ( size_t i = 0 ; i != number_of_function ; ++i ) { - result += sorted_vector_of_distnaces[i]; + result += sorted_vector_of_distances[i]; } return result; } template -void Vector_distances_in_diagram::compute_average( std::vector< Abs_Topological_data_with_averages* > to_average ) +void Vector_distances_in_diagram::compute_average( const std::vector< Abs_Topological_data_with_averages* >& to_average ) { if ( to_average.size() == 0 ) @@ -455,9 +455,9 @@ void Vector_distances_in_diagram::compute_average( std::vector< Abs_Topologic for ( size_t i = 0 ; i != to_average.size() ; ++i ) { Vector_distances_in_diagram* current = (Vector_distances_in_diagram*)to_average[i]; - if ( current->sorted_vector_of_distnaces.size() > maximal_length_of_vector ) + if ( current->sorted_vector_of_distances.size() > maximal_length_of_vector ) { - maximal_length_of_vector = current->sorted_vector_of_distnaces.size(); + maximal_length_of_vector = current->sorted_vector_of_distances.size(); } } @@ -467,9 +467,9 @@ void Vector_distances_in_diagram::compute_average( std::vector< Abs_Topologic for ( size_t i = 0 ; i != to_average.size() ; ++i ) { Vector_distances_in_diagram* current = (Vector_distances_in_diagram*)to_average[i]; - for ( size_t j = 0 ; j != current->sorted_vector_of_distnaces.size() ; ++j ) + for ( size_t j = 0 ; j != current->sorted_vector_of_distances.size() ; ++j ) { - av[j] += current->sorted_vector_of_distnaces[j]; + av[j] += current->sorted_vector_of_distances[j]; } } @@ -477,7 +477,7 @@ void Vector_distances_in_diagram::compute_average( std::vector< Abs_Topologic { av[i] /= (double)to_average.size(); } - this->sorted_vector_of_distnaces = av; + this->sorted_vector_of_distances = av; this->where_to_cut = av.size(); } @@ -498,40 +498,40 @@ double Vector_distances_in_diagram::distance( const Abs_Topological_data_with double result = 0; - for ( size_t i = 0 ; i != std::min(this->sorted_vector_of_distnaces.size(), second_->sorted_vector_of_distnaces.size()) ; ++i ) + for ( size_t i = 0 ; i != std::min(this->sorted_vector_of_distances.size(), second_->sorted_vector_of_distances.size()) ; ++i ) { if ( power == 1 ) { if ( dbg ) { - cerr << "|" << this->sorted_vector_of_distnaces[i] << " - " << second_->sorted_vector_of_distnaces[i] << " | : " << fabs( this->sorted_vector_of_distnaces[i] - second_->sorted_vector_of_distnaces[i] ) << endl; + cerr << "|" << this->sorted_vector_of_distances[i] << " - " << second_->sorted_vector_of_distances[i] << " | : " << fabs( this->sorted_vector_of_distances[i] - second_->sorted_vector_of_distances[i] ) << endl; } - result += fabs( this->sorted_vector_of_distnaces[i] - second_->sorted_vector_of_distnaces[i] ); + result += fabs( this->sorted_vector_of_distances[i] - second_->sorted_vector_of_distances[i] ); } else { - result += std::pow( fabs( this->sorted_vector_of_distnaces[i] - second_->sorted_vector_of_distnaces[i] ) , power ); + result += std::pow( fabs( this->sorted_vector_of_distances[i] - second_->sorted_vector_of_distances[i] ) , power ); if ( dbg ) { - cerr << "| " << this->sorted_vector_of_distnaces[i] << " - " << second_->sorted_vector_of_distnaces[i] << " : " << fabs( this->sorted_vector_of_distnaces[i] - second_->sorted_vector_of_distnaces[i] ) << endl; + cerr << "| " << this->sorted_vector_of_distances[i] << " - " << second_->sorted_vector_of_distances[i] << " : " << fabs( this->sorted_vector_of_distances[i] - second_->sorted_vector_of_distances[i] ) << endl; } } } - if ( this->sorted_vector_of_distnaces.size() != second_->sorted_vector_of_distnaces.size() ) + if ( this->sorted_vector_of_distances.size() != second_->sorted_vector_of_distances.size() ) { - if ( this->sorted_vector_of_distnaces.size() > second_->sorted_vector_of_distnaces.size() ) + if ( this->sorted_vector_of_distances.size() > second_->sorted_vector_of_distances.size() ) { - for ( size_t i = second_->sorted_vector_of_distnaces.size() ; i != this->sorted_vector_of_distnaces.size() ; ++i ) + for ( size_t i = second_->sorted_vector_of_distances.size() ; i != this->sorted_vector_of_distances.size() ; ++i ) { - result += fabs( this->sorted_vector_of_distnaces[i] ); + result += fabs( this->sorted_vector_of_distances[i] ); } } else { - //this->sorted_vector_of_distnaces.size() < second_->sorted_vector_of_distnaces.size() - for ( size_t i = this->sorted_vector_of_distnaces.size() ; i != second_->sorted_vector_of_distnaces.size() ; ++i ) + //this->sorted_vector_of_distances.size() < second_->sorted_vector_of_distances.size() + for ( size_t i = this->sorted_vector_of_distances.size() ; i != second_->sorted_vector_of_distances.size() ; ++i ) { - result += fabs( second_->sorted_vector_of_distnaces[i] ); + result += fabs( second_->sorted_vector_of_distances[i] ); } } } @@ -550,10 +550,10 @@ std::vector Vector_distances_in_diagram::vectorize( int number_of_fun if ( number_of_function > this->number_of_functions_for_vectorization )throw "Wrong index of a function in a method Vector_distances_in_diagram::vectorize"; if ( number_of_function < 0 )throw "Wrong index of a function in a method Vector_distances_in_diagram::vectorize"; - std::vector< double > result( std::min( (size_t)number_of_function , this->sorted_vector_of_distnaces.size() ) ); - for ( size_t i = 0 ; i != std::min( (size_t)number_of_function , this->sorted_vector_of_distnaces.size() ) ; ++i ) + std::vector< double > result( std::min( (size_t)number_of_function , this->sorted_vector_of_distances.size() ) ); + for ( size_t i = 0 ; i != std::min( (size_t)number_of_function , this->sorted_vector_of_distances.size() ) ; ++i ) { - result[i] = this->sorted_vector_of_distnaces[i]; + result[i] = this->sorted_vector_of_distances[i]; } return result; } @@ -565,9 +565,9 @@ void Vector_distances_in_diagram::write_to_file( const char* filename ) std::ofstream out; out.open( filename ); - for ( size_t i = 0 ; i != this->sorted_vector_of_distnaces.size() ; ++i ) + for ( size_t i = 0 ; i != this->sorted_vector_of_distances.size() ; ++i ) { - out << this->sorted_vector_of_distnaces[i] << " "; + out << this->sorted_vector_of_distances[i] << " "; } out.close(); @@ -590,7 +590,7 @@ void Vector_distances_in_diagram::load_from_file( const char* filename ) { in >> number; if ( in.eof() )break; - this->sorted_vector_of_distnaces.push_back(number); + this->sorted_vector_of_distances.push_back(number); } in.close(); } @@ -601,9 +601,9 @@ double Vector_distances_in_diagram::compute_scalar_product( const Abs_Topolog Vector_distances_in_diagram* second_vector = (Vector_distances_in_diagram*)second; double result = 0; - for ( size_t i = 0 ; i != std::min(this->sorted_vector_of_distnaces.size(),second_vector->sorted_vector_of_distnaces.size()) ; ++i ) + for ( size_t i = 0 ; i != std::min(this->sorted_vector_of_distances.size(),second_vector->sorted_vector_of_distances.size()) ; ++i ) { - result += this->sorted_vector_of_distnaces[i] * second_vector->sorted_vector_of_distnaces[i]; + result += this->sorted_vector_of_distances[i] * second_vector->sorted_vector_of_distances[i]; } return result; } diff --git a/src/Gudhi_stat/include/gudhi/concretizations/read_persitence_from_file.h b/src/Gudhi_stat/include/gudhi/concretizations/read_persitence_from_file.h index d2e6ec3c..03446289 100644 --- a/src/Gudhi_stat/include/gudhi/concretizations/read_persitence_from_file.h +++ b/src/Gudhi_stat/include/gudhi/concretizations/read_persitence_from_file.h @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 @@ -35,7 +35,12 @@ namespace Gudhi namespace Gudhi_stat { - +/** + * This method reads persistence from standalone file. The format of the file is as follows: + * In every line there are two numbers which denotes birth and death of a persistence interval. The file is not supposed to contains any nonwhite characters excet from digits. In particular symbols + * like 'inf' are not allowed. + * If begin of the interval is greater than the end of the interval, those two numbers are swapped. +**/ std::vector< std::pair< double , double > > read_standard_file( const char* filename ) { bool dbg = false; @@ -78,6 +83,17 @@ std::vector< std::pair< double , double > > read_standard_file( const char* file return barcode; }//read_standard_file + + +/** + * This procedure reads Gudhi style file. The format of a Gudhi style file is as follows: + * Each line consist of the following information: + * A prime number p indicating that the class is nontrivial over Z_p field. + * A positive numebr, being a dimension of a persistence class + * A birth and a death time of a class. + * Death time may be infitnity, in which case a string 'inf' is used. + * If begin of the interval is greater than the end of the interval, those two numbers are swapped. +**/ std::vector< std::pair< double , double > > read_gudhi_file( const char* filename , size_t dimension = 0 ) { bool dbg = false; diff --git a/src/Gudhi_stat/test/persistence_heat_maps_test.cpp b/src/Gudhi_stat/test/persistence_heat_maps_test.cpp index 505b1912..c4c97d72 100644 --- a/src/Gudhi_stat/test/persistence_heat_maps_test.cpp +++ b/src/Gudhi_stat/test/persistence_heat_maps_test.cpp @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 diff --git a/src/Gudhi_stat/test/persistence_intervals_test.cpp b/src/Gudhi_stat/test/persistence_intervals_test.cpp index 70e20ed0..f86300fa 100644 --- a/src/Gudhi_stat/test/persistence_intervals_test.cpp +++ b/src/Gudhi_stat/test/persistence_intervals_test.cpp @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 diff --git a/src/Gudhi_stat/test/persistence_lanscapes_on_grid_test.cpp b/src/Gudhi_stat/test/persistence_lanscapes_on_grid_test.cpp index 7d0b58a5..d7d72d6b 100644 --- a/src/Gudhi_stat/test/persistence_lanscapes_on_grid_test.cpp +++ b/src/Gudhi_stat/test/persistence_lanscapes_on_grid_test.cpp @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 diff --git a/src/Gudhi_stat/test/persistence_lanscapes_test.cpp b/src/Gudhi_stat/test/persistence_lanscapes_test.cpp index 8a7d0ce1..9506410a 100644 --- a/src/Gudhi_stat/test/persistence_lanscapes_test.cpp +++ b/src/Gudhi_stat/test/persistence_lanscapes_test.cpp @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 diff --git a/src/Gudhi_stat/test/vector_representation_test.cpp b/src/Gudhi_stat/test/vector_representation_test.cpp index e87d1b23..44801ad9 100644 --- a/src/Gudhi_stat/test/vector_representation_test.cpp +++ b/src/Gudhi_stat/test/vector_representation_test.cpp @@ -4,7 +4,7 @@ * * Author(s): Pawel Dlotko * - * Copyright (C) 2015 INRIA Sophia-Saclay (France) + * Copyright (C) 2015 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 @@ -22,7 +22,7 @@ #include -#include +#include #include #define BOOST_TEST_DYN_LINK diff --git a/src/Gudhi_stat/utilities/CMakeLists.txt b/src/Gudhi_stat/utilities/CMakeLists.txt new file mode 100644 index 00000000..d75acc43 --- /dev/null +++ b/src/Gudhi_stat/utilities/CMakeLists.txt @@ -0,0 +1,103 @@ +cmake_minimum_required(VERSION 2.6) +project(GUDHI_STAT) + + + +#persitence diagrams +add_executable ( persistence_intervals/plot_persistence_intervals persistence_intervals/plot_persistence_intervals.cpp ) +target_link_libraries( persistence_intervals/plot_persistence_intervals ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_intervals/compute_birth_death_range_in_persistence_diagram persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp ) +target_link_libraries( persistence_intervals/compute_birth_death_range_in_persistence_diagram ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_intervals/compute_number_of_dominant_intervals persistence_intervals/compute_number_of_dominant_intervals.cpp ) +target_link_libraries( persistence_intervals/compute_number_of_dominant_intervals ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_intervals/plot_histogram_of_intervals_lengths persistence_intervals/plot_histogram_of_intervals_lengths.cpp ) +target_link_libraries( persistence_intervals/plot_histogram_of_intervals_lengths ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_intervals/plot_persistence_Betti_numebrs persistence_intervals/plot_persistence_Betti_numebrs.cpp ) +target_link_libraries( persistence_intervals/plot_persistence_Betti_numebrs ${Boost_SYSTEM_LIBRARY}) + +#when we have bottleneck and wasserstein distance computations, add suitable programs here. + + +#persitence landscapes +add_executable ( persistence_landscapes/average_landscapes persistence_landscapes/average_landscapes.cpp ) +target_link_libraries(persistence_landscapes/average_landscapes ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_landscapes/create_landscapes persistence_landscapes/create_landscapes.cpp ) +target_link_libraries(persistence_landscapes/create_landscapes ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_landscapes/plot_landscapes persistence_landscapes/plot_landscapes.cpp ) +target_link_libraries(persistence_landscapes/plot_landscapes ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_landscapes/compute_distance_of_landscapes persistence_landscapes/compute_distance_of_landscapes.cpp ) +target_link_libraries(persistence_landscapes/compute_distance_of_landscapes ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_landscapes/compute_scalar_product_of_landscapes persistence_landscapes/compute_scalar_product_of_landscapes.cpp ) +target_link_libraries(persistence_landscapes/compute_scalar_product_of_landscapes ${Boost_SYSTEM_LIBRARY}) + +#persitence landscapes on a grid +add_executable ( persistence_landscapes_on_grid/average_landscapes_on_grid persistence_landscapes_on_grid/average_landscapes_on_grid.cpp ) +target_link_libraries(persistence_landscapes_on_grid/average_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_landscapes_on_grid/create_landscapes_on_grid persistence_landscapes_on_grid/create_landscapes_on_grid.cpp ) +target_link_libraries(persistence_landscapes_on_grid/create_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_landscapes_on_grid/plot_landscapes_on_grid persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp ) +target_link_libraries(persistence_landscapes_on_grid/plot_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp ) +target_link_libraries(persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp ) +target_link_libraries(persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) + +#persitence heat maps +add_executable ( persistence_heat_maps/average_persistence_heat_maps persistence_heat_maps/average_persistence_heat_maps.cpp ) +target_link_libraries(persistence_heat_maps/average_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_heat_maps/create_persistence_heat_maps persistence_heat_maps/create_persistence_heat_maps.cpp ) +target_link_libraries(persistence_heat_maps/create_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_heat_maps/plot_persistence_heat_map persistence_heat_maps/plot_persistence_heat_map.cpp ) +target_link_libraries(persistence_heat_maps/plot_persistence_heat_map ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_heat_maps/compute_distance_of_persistence_heat_maps persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp ) +target_link_libraries(persistence_heat_maps/compute_distance_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp ) +target_link_libraries(persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_heat_maps/create_pssk persistence_heat_maps/create_pssk.cpp ) +target_link_libraries(persistence_heat_maps/create_pssk ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp ) +target_link_libraries(persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp ) +target_link_libraries(persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp ) +target_link_libraries(persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence ${Boost_SYSTEM_LIBRARY}) + + +#persitence vectors +add_executable ( persistence_vectors/average_persistence_vectors persistence_vectors/average_persistence_vectors.cpp ) +target_link_libraries(persistence_vectors/average_persistence_vectors ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_vectors/create_persistence_vectors persistence_vectors/create_persistence_vectors.cpp ) +target_link_libraries(persistence_vectors/create_persistence_vectors ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_vectors/compute_distance_of_persistence_vectors persistence_vectors/compute_distance_of_persistence_vectors.cpp ) +target_link_libraries(persistence_vectors/compute_distance_of_persistence_vectors ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_vectors/compute_scalar_product_of_persistence_vectors persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp ) +target_link_libraries(persistence_vectors/compute_scalar_product_of_persistence_vectors ${Boost_SYSTEM_LIBRARY}) + +add_executable ( persistence_vectors/plot_persistence_vectors persistence_vectors/plot_persistence_vectors.cpp ) +target_link_libraries(persistence_vectors/plot_persistence_vectors ${Boost_SYSTEM_LIBRARY}) + + + diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp b/src/Gudhi_stat/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp new file mode 100644 index 00000000..811e4557 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp @@ -0,0 +1,73 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program computes average persistence landscape of persistence landscapes created based on persistence diagrams provided as an input. Please call this program with the names of files with persistence diagrams \n"; + std::vector< const char* > filenames; + + if ( argc == 1 ) + { + std::cout << "No input files given, the program will now terminate \n"; + return 1; + } + + for ( int i = 1 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + + std::cout << "Creating persistence landscapes...\n"; + std::vector< Abs_Topological_data_with_averages* > maps; + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + Persistence_heat_maps* l = new Persistence_heat_maps; + l->load_from_file( filenames[i] ); + maps.push_back( (Abs_Topological_data_with_averages*)l ); + } + + Persistence_heat_maps av; + av.compute_average( maps ); + + av.print_to_file( "average.mps" ); + + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + delete maps[i]; + } + + std::cout << "Done \n"; + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp b/src/Gudhi_stat/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp new file mode 100644 index 00000000..e462f009 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp @@ -0,0 +1,107 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program compute dsitance of persistence landscapes stored in a file (the file needs to be created beforehand). \n"; + std::cout << "The first parameter of a program is an interger p. The program compute L^p distance of the two landscapes. For L^infty distance choose p = -1. \n"; + std::cout << "The remaining parameters of this programs are names of files with persistence landscapes.\n"; + + if ( argc < 3 ) + { + std::cout << "Wrong number of parameters, the program will now terminate \n"; + return 1; + } + + int p = atoi( argv[1] ); + + std::vector< const char* > filenames; + for ( int i = 2 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + std::vector< Abs_Topological_data_with_distances* > maps; + maps.reserve( filenames.size() ); + for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) + { + Persistence_heat_maps* l = new Persistence_heat_maps; + l->load_from_file( filenames[file_no] ); + maps.push_back( (Abs_Topological_data_with_distances*)l ); + } + + //and now we will compute the scalar product of landscapes. + + //first we prepare an array: + std::vector< std::vector< double > > distance( filenames.size() ); + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + std::vector< double > v( filenames.size() , 0 ); + distance[i] = v; + } + + //and now we can compute the distnaces: + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + for ( size_t j = i ; j != filenames.size() ; ++j ) + { + distance[i][j] = distance[j][i] = ((Persistence_heat_maps*)maps[i])->distance( maps[j] , p ) ; + } + } + + //and now output the result to the screen and a file: + ofstream out; + out.open( "distance" ); + for ( size_t i = 0 ; i != distance.size() ; ++i ) + { + for ( size_t j = 0 ; j != distance.size() ; ++j ) + { + cout << distance[i][j] << " "; + out << distance[i][j] << " "; + } + cout << endl; + out << endl; + } + out.close(); + + return 0; +} + + + + + + + diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp b/src/Gudhi_stat/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp new file mode 100644 index 00000000..c9ffa22e --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp @@ -0,0 +1,91 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program compute scalar product of persistence landscapes stored in a file (the file needs to be created beforehand). \n"; + std::cout << "The parameters of this programs are names of files with persistence landscapes.\n"; + + std::vector< const char* > filenames; + for ( int i = 1 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + std::vector< Persistence_heat_maps* > maps; + maps.reserve( filenames.size() ); + for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) + { + Persistence_heat_maps* l = new Persistence_heat_maps; + l->load_from_file( filenames[file_no] ); + maps.push_back( l ); + } + + //and now we will compute the scalar product of landscapes. + + //first we prepare an array: + std::vector< std::vector< double > > scalar_product( filenames.size() ); + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + std::vector< double > v( filenames.size() , 0 ); + scalar_product[i] = v; + } + + //and now we can compute the scalar product: + for ( size_t i = 0 ; i != maps.size() ; ++i ) + { + for ( size_t j = i ; j != maps.size() ; ++j ) + { + scalar_product[i][j] = scalar_product[j][i] = ((Persistence_heat_maps*)maps[i])->compute_scalar_product( maps[j] ) ; + } + } + + //and now output the result to the screen and a file: + ofstream out; + out.open( "scalar_product" ); + for ( size_t i = 0 ; i != scalar_product.size() ; ++i ) + { + for ( size_t j = 0 ; j != scalar_product.size() ; ++j ) + { + cout << scalar_product[i][j] << " "; + out << scalar_product[i][j] << " "; + } + cout << endl; + out << endl; + } + out.close(); + + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp new file mode 100644 index 00000000..2cc00b87 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp @@ -0,0 +1,79 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + + +int main( int argc , char** argv ) +{ + std::cout << "This program creates persistence heat map of diagrams provided as an input.\n"; + std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; + std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n"; + std::cerr << "The fourth parameter is an integer, the standard deviation of a gaussian kernel expressed in a number of pixels \n"; + std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; + + if ( argc < 5 ) + { + std::cout << "Wrong parameter list, the program will now terminate \n"; + return 1; + } + + size_t size_of_grid = (size_t)atoi( argv[1] ); + double min_ = atof( argv[2] ); + double max_ = atof( argv[3] ); + size_t stdiv = atof( argv[4] ); + + std::vector< const char* > filenames; + for ( int i = 5 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + + + + std::cout << "Creating persistence heat maps...\n"; + std::vector< std::vector > filter = create_Gaussian_filter(stdiv,1); + + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; + Persistence_heat_maps l( filenames[i] , filter, constant_function, false , size_of_grid , min_ , max_ ); + + std::stringstream ss; + ss << filenames[i] << ".mps"; + l.print_to_file( ss.str().c_str() ); + } + std::cout << "Done \n"; + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp new file mode 100644 index 00000000..ae579329 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp @@ -0,0 +1,79 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + + +int main( int argc , char** argv ) +{ + std::cout << "This program creates persistence heat map of diagrams provided as an input. The Gaussian kernels are weighted by the arcus tangens of their persistence.\n"; + std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; + std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n"; + std::cerr << "The fourth parameter is an integer, the standard deviation of a gaussian kernel expressed in a number of pixels \n"; + std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; + + if ( argc < 5 ) + { + std::cout << "Wrong parameter list, the program will now terminate \n"; + return 1; + } + + size_t size_of_grid = (size_t)atoi( argv[1] ); + double min_ = atof( argv[2] ); + double max_ = atof( argv[3] ); + size_t stdiv = atof( argv[4] ); + + std::vector< const char* > filenames; + for ( int i = 5 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + + + + std::cout << "Creating persistence heat maps...\n"; + std::vector< std::vector > filter = create_Gaussian_filter(stdiv,1); + + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; + Persistence_heat_maps l( filenames[i] , filter, arc_tan_of_persistence_of_point, false , size_of_grid , min_ , max_ ); + + std::stringstream ss; + ss << filenames[i] << ".mps"; + l.print_to_file( ss.str().c_str() ); + } + std::cout << "Done \n"; + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp new file mode 100644 index 00000000..7877d699 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp @@ -0,0 +1,79 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + + +int main( int argc , char** argv ) +{ + std::cout << "This program creates persistence heat map of diagrams provided as an input. The Gaussian kernels are weighted by the distance of a center from the diagonal.\n"; + std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; + std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n"; + std::cerr << "The fourth parameter is an integer, the standard deviation of a gaussian kernel expressed in a number of pixels \n"; + std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; + + if ( argc < 5 ) + { + std::cout << "Wrong parameter list, the program will now terminate \n"; + return 1; + } + + size_t size_of_grid = (size_t)atoi( argv[1] ); + double min_ = atof( argv[2] ); + double max_ = atof( argv[3] ); + size_t stdiv = atof( argv[4] ); + + std::vector< const char* > filenames; + for ( int i = 5 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + + + + std::cout << "Creating persistence heat maps...\n"; + std::vector< std::vector > filter = create_Gaussian_filter(stdiv,1); + + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; + Persistence_heat_maps l( filenames[i] , filter, distance_from_diagonal, false , size_of_grid , min_ , max_ ); + + std::stringstream ss; + ss << filenames[i] << ".mps"; + l.print_to_file( ss.str().c_str() ); + } + std::cout << "Done \n"; + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp new file mode 100644 index 00000000..67972afe --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp @@ -0,0 +1,79 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + + +int main( int argc , char** argv ) +{ + std::cout << "This program creates persistence heat map of diagrams provided as an input. The Gaussian kernels are weighted by the square of distance of a center from the diagonal.\n"; + std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; + std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n"; + std::cerr << "The fourth parameter is an integer, the standard deviation of a gaussian kernel expressed in a number of pixels \n"; + std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; + + if ( argc < 5 ) + { + std::cout << "Wrong parameter list, the program will now terminate \n"; + return 1; + } + + size_t size_of_grid = (size_t)atoi( argv[1] ); + double min_ = atof( argv[2] ); + double max_ = atof( argv[3] ); + size_t stdiv = atof( argv[4] ); + + std::vector< const char* > filenames; + for ( int i = 5 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + + + + std::cout << "Creating persistence heat maps...\n"; + std::vector< std::vector > filter = create_Gaussian_filter(stdiv,1); + + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; + Persistence_heat_maps l( filenames[i] , filter, squared_distance_from_diagonal, false , size_of_grid , min_ , max_ ); + + std::stringstream ss; + ss << filenames[i] << ".mps"; + l.print_to_file( ss.str().c_str() ); + } + std::cout << "Done \n"; + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/create_pssk.cpp b/src/Gudhi_stat/utilities/persistence_heat_maps/create_pssk.cpp new file mode 100644 index 00000000..1fc9d263 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_heat_maps/create_pssk.cpp @@ -0,0 +1,77 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + + +int main( int argc , char** argv ) +{ + std::cout << "This program creates PSSK of diagrams provided as an input.\n"; + std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; + std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n"; + std::cerr << "The fourth parameter is an integer, the standard deviation of a gaussian kernel expressed in a number of pixels \n"; + std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; + + if ( argc < 5 ) + { + std::cout << "Wrong parameter list, the program will now terminate \n"; + return 1; + } + + size_t size_of_grid = (size_t)atoi( argv[1] ); + double min_ = atof( argv[2] ); + double max_ = atof( argv[3] ); + size_t stdiv = atof( argv[4] ); + + std::vector< const char* > filenames; + for ( int i = 5 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + + std::cout << "Creating persistence heat maps...\n"; + std::vector< std::vector > filter = create_Gaussian_filter(stdiv,1); + + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl; + PSSK l( filenames[i] , filter , size_of_grid , min_ , max_ ); + + std::stringstream ss; + ss << filenames[i] << ".pssk"; + l.print_to_file( ss.str().c_str() ); + } + std::cout << "Done \n"; + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp b/src/Gudhi_stat/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp new file mode 100644 index 00000000..6b67ea57 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp @@ -0,0 +1,44 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program plot persistence landscape stored in a file (the file needs to be created beforehand). Please call the code with the name of a landsape file \n"; + Persistence_heat_maps l; + l.load_from_file( argv[1] ); + l.plot( argv[1] ); + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp b/src/Gudhi_stat/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp new file mode 100644 index 00000000..2c55a806 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp @@ -0,0 +1,72 @@ +/* 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 (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 + +#include +#include +#include + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +using namespace std; + + +int main( int argc , char** argv ) +{ + //std::cout << "This program compute minimum birth and the maximum death time for a collection of persistence intervals \n"; + //if ( argc != 2 ) + //{ + // 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 min_max_ = p.min_max(); + //cout << "Birth-death range : min: " << min_max_.first << ", max: " << min_max_.second << endl; + + std::vector< const char* > filenames; + for ( int i = 1 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + + double min_ = std::numeric_limits::max(); + double max_ = -std::numeric_limits::max(); + + for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) + { + std::cout << "Creating diagram based on a file : " << filenames[file_no] << std::endl; + Persistence_intervals p( filenames[file_no] ); + std::pair min_max_ = p.min_max(); + if ( min_max_.first < min_ )min_ = min_max_.first; + if ( min_max_.second > max_ )max_ = min_max_.second; + } + cout << "Birth-death range : min: " << min_ << ", max: " << max_ << endl; + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp b/src/Gudhi_stat/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp new file mode 100644 index 00000000..b29aea3a --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp @@ -0,0 +1,57 @@ +/* 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 (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 + +#include + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +using namespace std; + + +int main( int argc , char** argv ) +{ + std::cout << "This program compute the dominant intervals. A number of intervals to be displayed is a parameter of this program. \n"; + if ( argc != 3 ) + { + cout << "To run this program, please provide the name of a file with persistence diagram and number of dominant intervals you would like to get \n"; + return 1; + } + + Persistence_intervals p( argv[1] ); + std::vector< std::pair > dominant_intervals = p.dominant_intervals( atoi( argv[2] ) ); + cout << "Here are the dominant intervals : " << endl; + for ( size_t i = 0 ; i != dominant_intervals.size() ; ++i ) + { + cout << " " << dominant_intervals[i].first<< "," << dominant_intervals[i].second << " "<< endl; + } + + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp b/src/Gudhi_stat/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp new file mode 100644 index 00000000..99f7e640 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp @@ -0,0 +1,69 @@ +/* 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 (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 + +#include + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +using namespace std; + + +int main( int argc , char** argv ) +{ + std::cout << "This program compute a histogram of barcode's length. A number of bins in the histogram is a parameter of this program. \n"; + if ( argc != 3 ) + { + cout << "To run this program, please provide the name of a file with persistence diagram and number of dominant intervals you would like to get \n"; + return 1; + } + + Persistence_intervals p( argv[1] ); + std::vector< std::pair > dominant_intervals = p.dominant_intervals( atoi( argv[2] ) ); + std::vector< size_t > histogram = p.histograms_of_lengths( 10 ); + + std::stringstream gnuplot_script; + gnuplot_script << argv[1] << "_Gnuplot_script"; + ofstream out; + out.open( gnuplot_script.str().c_str() ); + + out << "set style data histogram" << std::endl; + out << "set style histogram cluster gap 1" << std::endl; + out << "set style fill solid border -1" << std::endl; + out << "plot '-' notitle" << std::endl; + for ( size_t i = 0 ; i != histogram.size() ; ++i ) + { + out << histogram[i] << std::endl; + } + out << endl; + std::cout << "To vizualize, open gnuplot and type: load \'" << gnuplot_script.str().c_str() << "\'" << std::endl; + out.close(); + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp b/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp new file mode 100644 index 00000000..e23a4f20 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp @@ -0,0 +1,93 @@ +/* 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 (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 + +#include + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +using namespace std; + + +int main( int argc , char** argv ) +{ + std::cout << "This program compute a plot of persistence Betti numbers. The input parameter is a file with persistence intervals. \n"; + if ( argc != 2 ) + { + cout << "To run this program, please provide the name of a file with persistence diagram and number of dominant intervals you would like to get \n"; + return 1; + } + + + + std::stringstream gnuplot_script; + gnuplot_script << argv[1] << "_Gnuplot_script"; + ofstream out; + out.open( gnuplot_script.str().c_str() ); + + Persistence_intervals p( argv[1] ); + std::vector< std::pair< double , size_t > > pbns = p.compute_persistent_betti_numbers(); + + //set up the ranges so that we see the image well. + double xRangeBegin = pbns[0].first; + double xRangeEnd = pbns[ pbns.size()-1 ].first; + double yRangeBegin = 0; + double yRangeEnd = 0; + for ( size_t i = 0 ; i != pbns.size() ; ++i ) + { + if ( pbns[i].second > yRangeEnd )yRangeEnd = pbns[i].second; + } + xRangeBegin -= (xRangeEnd -xRangeBegin)/100.0; + xRangeEnd += (xRangeEnd -xRangeBegin)/100.0; + yRangeEnd += yRangeEnd/100; + + + out << "set xrange [" << xRangeBegin << " : " << xRangeEnd << "]" << endl; + out << "set yrange [" << yRangeBegin << " : " << yRangeEnd << "]" << endl; + out << "plot '-' using 1:2 notitle with lp " << std::endl; + double previous_y = 0; + for ( size_t i = 0 ; i != pbns.size() ; ++i ) + { + out << pbns[i].first << " " << previous_y << endl; + out << pbns[i].first << " " << pbns[i].second << std::endl; + previous_y = pbns[i].second; + } + out << endl; + out.close(); + + //for ( size_t i = 0 ; i != pbns.size() ; ++i ) + //{ + // cout << pbns[i].first << " " << pbns[i].second << std::endl; + //} + + std::cout << "To vizualize, open gnuplot and type: load \'" << gnuplot_script.str().c_str() << "\'" << std::endl; + + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_intervals.cpp b/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_intervals.cpp new file mode 100644 index 00000000..5950240e --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_intervals.cpp @@ -0,0 +1,59 @@ +/* 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 (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 + +#include + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + + +double epsilon = 0.0000005; + +using namespace std; + + +int main( int argc , char** argv ) +{ + if ( argc != 2 ) + { + cout << "To run this program, please provide the name of a file with persistence diagram \n"; + return 1; + } + Persistence_intervals b( argv[1] ); + b.plot( argv[1] ); + return 0; +} + + + + + + + diff --git a/src/Gudhi_stat/utilities/persistence_landscapes/average_landscapes.cpp b/src/Gudhi_stat/utilities/persistence_landscapes/average_landscapes.cpp new file mode 100644 index 00000000..895146f5 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_landscapes/average_landscapes.cpp @@ -0,0 +1,75 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program computes average persistence landscape of persistence landscapes created based on persistence diagrams provided as an input (you must create them first).\n"; + std::cout << "Please call this program with the names of files with persistence landscapes. The program will create a persistence landscape which will be their average \n"; + std::vector< const char* > filenames; + + if ( argc == 1 ) + { + std::cout << "No input files given, the program will now terminate \n"; + return 1; + } + + for ( int i = 1 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + + std::cout << "Creating persistence landscapes...\n"; + std::vector< Abs_Topological_data_with_averages* > lands; + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + Persistence_landscape* l = new Persistence_landscape; + l->load_landscape_from_file( filenames[i] ); + lands.push_back( (Abs_Topological_data_with_averages*)l ); + } + + Persistence_landscape av; + av.compute_average( lands ); + + av.print_to_file( "average.land" ); + + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + delete lands[i]; + } + + std::cout << "Done \n"; + + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp b/src/Gudhi_stat/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp new file mode 100644 index 00000000..34ec0bfa --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp @@ -0,0 +1,109 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program compute distance of persistence landscapes stored in a file (the file needs to be created beforehand). \n"; + std::cout << "The first parameter of a program is an interger p. The program compute L^p distance of the given landscapes. For L^infty distance choose p = -1. \n"; + std::cout << "The remaining parameters of this programs are names of files with persistence landscapes."; + + if ( argc < 3 ) + { + std::cout << "Wrong number of parameters, the program will now terminate \n"; + return 1; + } + + int p = atoi( argv[1] ); + + std::vector< const char* > filenames; + for ( int i = 2 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + std::vector< Persistence_landscape > landscaspes; + landscaspes.reserve( filenames.size() ); + for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) + { + std::cout << "Loading persistence landscape from a file : " << filenames[file_no] << std::endl; + Persistence_landscape l; + l.load_landscape_from_file( filenames[file_no] ); + landscaspes.push_back( l ); + } + + //and now we will compute the scalar product of landscapes. + + //first we prepare an array: + std::vector< std::vector< double > > distance( filenames.size() ); + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + std::vector< double > v( filenames.size() , 0 ); + distance[i] = v; + } + + //and now we can compute the distances: + for ( size_t i = 0 ; i != landscaspes.size() ; ++i ) + { + for ( size_t j = i ; j != landscaspes.size() ; ++j ) + { + distance[i][j] = distance[j][i] = compute_discance_of_landscapes( landscaspes[i], landscaspes[j] , p ) ; + + } + } + + //and now output the result to the screen and a file: + ofstream out; + out.open( "distance" ); + for ( size_t i = 0 ; i != distance.size() ; ++i ) + { + for ( size_t j = 0 ; j != distance.size() ; ++j ) + { + cout << distance[i][j] << " "; + out << distance[i][j] << " "; + } + cout << endl; + out << endl; + } + out.close(); + + return 0; +} + + + + + + + diff --git a/src/Gudhi_stat/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp b/src/Gudhi_stat/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp new file mode 100644 index 00000000..443240ff --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp @@ -0,0 +1,92 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program compute scalar product of persistence landscapes stored in a file (the file needs to be created beforehand). \n"; + std::cout << "The parameters of this programs are names of files with persistence landscapes.\n"; + + std::vector< const char* > filenames; + for ( int i = 1 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + std::vector< Persistence_landscape > landscaspes; + landscaspes.reserve( filenames.size() ); + for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) + { + std::cout << "Reading persistence landscape from a file : " << filenames[file_no] << std::endl; + Persistence_landscape l; + l.load_landscape_from_file( filenames[file_no] ); + landscaspes.push_back( l ); + } + + //and now we will compute the scalar product of landscapes. + + //first we prepare an array: + std::vector< std::vector< double > > scalar_product( filenames.size() ); + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + std::vector< double > v( filenames.size() , 0 ); + scalar_product[i] = v; + } + + //and now we can compute the scalar product: + for ( size_t i = 0 ; i != landscaspes.size() ; ++i ) + { + for ( size_t j = i ; j != landscaspes.size() ; ++j ) + { + scalar_product[i][j] = scalar_product[j][i] = compute_inner_product( landscaspes[i], landscaspes[j] ) ; + } + } + + //and now output the result to the screen and a file: + ofstream out; + out.open( "scalar_product" ); + for ( size_t i = 0 ; i != scalar_product.size() ; ++i ) + { + for ( size_t j = 0 ; j != scalar_product.size() ; ++j ) + { + cout << scalar_product[i][j] << " "; + out << scalar_product[i][j] << " "; + } + cout << endl; + out << endl; + } + out.close(); + + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_landscapes/create_landscapes.cpp b/src/Gudhi_stat/utilities/persistence_landscapes/create_landscapes.cpp new file mode 100644 index 00000000..fe96a067 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_landscapes/create_landscapes.cpp @@ -0,0 +1,56 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program creates persistence landscapes of diagrams provided as an input. Please call this program with the names of files with persistence diagrams \n"; + std::vector< const char* > filenames; + for ( int i = 1 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + + std::cout << "Creating persistence landscapes...\n"; + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + Persistence_landscape l( filenames[i] , 1 ); + std::stringstream ss; + ss << filenames[i] << ".land"; + l.print_to_file( ss.str().c_str() ); + } + std::cout << "Done \n"; + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_landscapes/plot_landscapes.cpp b/src/Gudhi_stat/utilities/persistence_landscapes/plot_landscapes.cpp new file mode 100644 index 00000000..e035e4aa --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_landscapes/plot_landscapes.cpp @@ -0,0 +1,50 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Author(s): Pawel Dlotko + * + * Copyright (C) 2015 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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program plot persistence landscape stored in a file (the file needs to be created beforehand). Please call the code with the name of a landsape file \n"; + Persistence_landscape l; + l.load_landscape_from_file( argv[1] ); + + std::stringstream ss; + ss << argv[1] << "_gnuplot_script"; + l.plot( ss.str().c_str() ); + + std::cout << "Done \n"; + + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp new file mode 100644 index 00000000..3b580181 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp @@ -0,0 +1,74 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program computes average persistence landscape on grid of persistence landscapes on grid created based on persistence diagrams provided as an input. Please call this program with the names of files with persistence diagrams \n"; + std::vector< const char* > filenames; + + if ( argc == 1 ) + { + std::cout << "No input files given, the program will now terminate \n"; + return 1; + } + + for ( int i = 1 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + + std::cout << "Creating persistence landscapes...\n"; + std::vector< Abs_Topological_data_with_averages* > lands; + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + Persistence_landscape_on_grid* l = new Persistence_landscape_on_grid; + l->load_landscape_from_file( filenames[i] ); + lands.push_back( (Abs_Topological_data_with_averages*)l ); + } + + Persistence_landscape_on_grid av; + av.compute_average( lands ); + + av.print_to_file( "average.g_land" ); + + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + delete lands[i]; + } + + std::cout << "Done \n"; + + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp new file mode 100644 index 00000000..1813e297 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp @@ -0,0 +1,107 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program compute dsitance of persistence landscapes on grid stored in a file (the file needs to be created beforehand). \n"; + std::cout << "The first parameter of a program is an interger p. The program compute L^p distance of the the landscapes on grid. For L^infty distance choose p = -1. \n"; + std::cout << "The remaining parameters of this programs are names of files with persistence landscapes on grid.\n"; + + if ( argc < 3 ) + { + std::cout << "Wrong number of parameters, the program will now terminate \n"; + return 1; + } + + int p = atoi( argv[1] ); + + std::vector< const char* > filenames; + for ( int i = 2 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + std::vector< Persistence_landscape_on_grid > landscaspes; + landscaspes.reserve( filenames.size() ); + for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) + { + Persistence_landscape_on_grid l; + l.load_landscape_from_file( filenames[file_no] ); + landscaspes.push_back( l ); + } + + //and now we will compute the scalar product of landscapes. + + //first we prepare an array: + std::vector< std::vector< double > > distance( filenames.size() ); + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + std::vector< double > v( filenames.size() , 0 ); + distance[i] = v; + } + + //and now we can compute the scalar product: + for ( size_t i = 0 ; i != landscaspes.size() ; ++i ) + { + for ( size_t j = i ; j != landscaspes.size() ; ++j ) + { + distance[i][j] = distance[j][i] = compute_discance_of_landscapes_on_grid( landscaspes[i], landscaspes[j] , p ) ; + } + } + + //and now output the result to the screen and a file: + ofstream out; + out.open( "distance" ); + for ( size_t i = 0 ; i != distance.size() ; ++i ) + { + for ( size_t j = 0 ; j != distance.size() ; ++j ) + { + cout << distance[i][j] << " "; + out << distance[i][j] << " "; + } + cout << endl; + out << endl; + } + out.close(); + + return 0; +} + + + + + + + diff --git a/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp new file mode 100644 index 00000000..33e111d5 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp @@ -0,0 +1,91 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program compute scalar product of persistence landscapes on grid stored in a file (the file needs to be created beforehand). \n"; + std::cout << "The parameters of this programs are names of files with persistence landscapes on grid.\n"; + + std::vector< const char* > filenames; + for ( int i = 1 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + std::vector< Persistence_landscape_on_grid > landscaspes; + landscaspes.reserve( filenames.size() ); + for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) + { + Persistence_landscape_on_grid l; + l.load_landscape_from_file( filenames[file_no] ); + landscaspes.push_back( l ); + } + + //and now we will compute the scalar product of landscapes. + + //first we prepare an array: + std::vector< std::vector< double > > scalar_product( filenames.size() ); + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + std::vector< double > v( filenames.size() , 0 ); + scalar_product[i] = v; + } + + //and now we can compute the scalar product: + for ( size_t i = 0 ; i != landscaspes.size() ; ++i ) + { + for ( size_t j = i ; j != landscaspes.size() ; ++j ) + { + scalar_product[i][j] = scalar_product[j][i] = compute_inner_product( landscaspes[i], landscaspes[j] ) ; + } + } + + //and now output the result to the screen and a file: + ofstream out; + out.open( "scalar_product" ); + for ( size_t i = 0 ; i != scalar_product.size() ; ++i ) + { + for ( size_t j = 0 ; j != scalar_product.size() ; ++j ) + { + cout << scalar_product[i][j] << " "; + out << scalar_product[i][j] << " "; + } + cout << endl; + out << endl; + } + out.close(); + + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp new file mode 100644 index 00000000..f6545e44 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp @@ -0,0 +1,80 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program creates persistence landscape on grid of diagrams provided as an input.\n"; + std::cout << "The first parameter of a program is an integer, a size of a grid.\n"; + std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n"; + std::cout << "The remaining parameters are the names of files with persistence diagrams. \n"; + + if ( argc < 4 ) + { + std::cout << "Wrong parameter list, the program will now terminate \n"; + return 1; + } + + size_t size_of_grid = (size_t)atoi( argv[1] ); + double min_ = atof( argv[2] ); + double max_ = atof( argv[3] ); + + std::vector< const char* > filenames; + for ( int i = 4 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + + std::cout << "Creating persistence landscapes...\n"; + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + std::cout << "Creating persistence landscape on a grid based on a file : " << filenames[i] << std::endl; + Persistence_landscape_on_grid l; + if ( (min_ != -1) || (max_ != -1) ) + { + l = Persistence_landscape_on_grid( filenames[i] , min_ , max_ , size_of_grid ); + } + else + { + //(min_ == -1) && (max_ == -1), in this case the program will find min_ and max_ based on the data. + l = Persistence_landscape_on_grid( filenames[i] , size_of_grid ); + } + std::stringstream ss; + ss << filenames[i] << ".g_land"; + l.print_to_file( ss.str().c_str() ); + } + std::cout << "Done \n"; + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp new file mode 100644 index 00000000..c12c3862 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp @@ -0,0 +1,55 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program plot persistence landscape on grid stored in a file (the file needs to be created beforehand). Please call the code with the name of a landsape on grid file \n"; + if ( argc == 1 ) + { + std::cout << "Wrong parameters of a program call, the program will now terminate \n"; + return 1; + } + Persistence_landscape_on_grid l; + l.load_landscape_from_file( argv[1] ); + + std::stringstream ss; + ss << argv[1] << "_gnuplot_script"; + l.plot( ss.str().c_str() ); + + std::cout << "Done \n"; + + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_vectors/average_persistence_vectors.cpp b/src/Gudhi_stat/utilities/persistence_vectors/average_persistence_vectors.cpp new file mode 100644 index 00000000..3262b157 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_vectors/average_persistence_vectors.cpp @@ -0,0 +1,75 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program computes average persistence vector of persistence vectors created based on persistence diagrams provided as an input. \n"; + std::cout << "Please call this program with the names of files with persistence diagrams \n"; + std::vector< const char* > filenames; + + if ( argc == 1 ) + { + std::cout << "No input files given, the program will now terminate \n"; + return 1; + } + + for ( int i = 1 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + + std::cout << "Reading persistence vectors...\n"; + std::vector< Abs_Topological_data_with_averages* > lands; + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + Vector_distances_in_diagram< euclidean_distance >* l = new Vector_distances_in_diagram< euclidean_distance >; + l->load_from_file( filenames[i] ); + lands.push_back( (Abs_Topological_data_with_averages*)l ); + } + + Vector_distances_in_diagram< euclidean_distance > av; + av.compute_average( lands ); + + av.print_to_file( "average.vect" ); + + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + delete lands[i]; + } + + std::cout << "Done \n"; + + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp b/src/Gudhi_stat/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp new file mode 100644 index 00000000..33d92a72 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp @@ -0,0 +1,108 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program compute distance of persistence vectors stored in a file (the file needs to be created beforehand). \n"; + std::cout << "The first parameter of a program is an interger p. The program compute l^p distance of the vectors. For l^infty distance choose p = -1. \n"; + std::cout << "The remaining parameters of this programs are names of files with persistence vectors.\n"; + + if ( argc < 3 ) + { + std::cout << "Wrong number of parameters, the program will now terminate \n"; + return 1; + } + + int p = atoi( argv[1] ); + + std::vector< const char* > filenames; + for ( int i = 2 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + std::vector< Vector_distances_in_diagram< euclidean_distance >* > vectors; + vectors.reserve( filenames.size() ); + for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) + { + //cerr << filenames[file_no] << endl; + Vector_distances_in_diagram< euclidean_distance >* l = new Vector_distances_in_diagram< euclidean_distance >; + l->load_from_file( filenames[file_no] ); + vectors.push_back( l ); + } + + //and now we will compute the scalar product of landscapes. + + //first we prepare an array: + std::vector< std::vector< double > > distance( filenames.size() ); + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + std::vector< double > v( filenames.size() , 0 ); + distance[i] = v; + } + + //and now we can compute the distances: + for ( size_t i = 0 ; i != vectors.size() ; ++i ) + { + for ( size_t j = i+1 ; j != vectors.size() ; ++j ) + { + distance[i][j] = distance[j][i] = ((Vector_distances_in_diagram< euclidean_distance >*)vectors[i])->distance( vectors[j] , p ) ; + } + } + + //and now output the result to the screen and a file: + ofstream out; + out.open( "distance" ); + for ( size_t i = 0 ; i != distance.size() ; ++i ) + { + for ( size_t j = 0 ; j != distance.size() ; ++j ) + { + cout << distance[i][j] << " "; + out << distance[i][j] << " "; + } + cout << endl; + out << endl; + } + out.close(); + + return 0; +} + + + + + + + diff --git a/src/Gudhi_stat/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp b/src/Gudhi_stat/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp new file mode 100644 index 00000000..5bea2765 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp @@ -0,0 +1,97 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program compute scalar product of persistence vectors stored in a file (the file needs to be created beforehand). \n"; + std::cout << "The parameters of this programs are names of files with persistence vectors.\n"; + + std::vector< const char* > filenames; + for ( int i = 1 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + std::vector< Vector_distances_in_diagram< euclidean_distance >* > vectors; + vectors.reserve( filenames.size() ); + for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no ) + { + Vector_distances_in_diagram< euclidean_distance >* l = new Vector_distances_in_diagram< euclidean_distance >; + l->load_from_file( filenames[file_no] ); + vectors.push_back( l ); + } + + //and now we will compute the scalar product of landscapes. + + //first we prepare an array: + std::vector< std::vector< double > > scalar_product( filenames.size() ); + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + std::vector< double > v( filenames.size() , 0 ); + scalar_product[i] = v; + } + + //and now we can compute the scalar product: + for ( size_t i = 0 ; i != vectors.size() ; ++i ) + { + for ( size_t j = i ; j != vectors.size() ; ++j ) + { + scalar_product[i][j] = scalar_product[j][i] = ((Vector_distances_in_diagram< euclidean_distance >*)vectors[i])->compute_scalar_product( vectors[j] ) ; + } + } + + //and now output the result to the screen and a file: + ofstream out; + out.open( "scalar_product" ); + for ( size_t i = 0 ; i != scalar_product.size() ; ++i ) + { + for ( size_t j = 0 ; j != scalar_product.size() ; ++j ) + { + cout << scalar_product[i][j] << " "; + out << scalar_product[i][j] << " "; + } + cout << endl; + out << endl; + } + out.close(); + + //cleaning up + for ( size_t i = 0 ; i != vectors.size() ; ++i ) + { + delete vectors[i]; + } + + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_vectors/create_persistence_vectors.cpp b/src/Gudhi_stat/utilities/persistence_vectors/create_persistence_vectors.cpp new file mode 100644 index 00000000..8e309b11 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_vectors/create_persistence_vectors.cpp @@ -0,0 +1,57 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program creates persistence vectors of diagrams provided as an input. Please call this program with the names of files with persistence diagrams \n"; + std::vector< const char* > filenames; + for ( int i = 1 ; i < argc ; ++i ) + { + filenames.push_back( argv[i] ); + } + + for ( size_t i = 0 ; i != filenames.size() ; ++i ) + { + std::cerr << "Creatign persistence vectors based on a file : " << filenames[i] << std::endl; + Vector_distances_in_diagram< euclidean_distance > l( filenames[i] , -1 ); + std::stringstream ss; + ss << filenames[i] << ".vect"; + l.print_to_file( ss.str().c_str() ); + } + std::cout << "Done \n"; + return 0; +} + diff --git a/src/Gudhi_stat/utilities/persistence_vectors/plot_persistence_vectors.cpp b/src/Gudhi_stat/utilities/persistence_vectors/plot_persistence_vectors.cpp new file mode 100644 index 00000000..53f53654 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_vectors/plot_persistence_vectors.cpp @@ -0,0 +1,51 @@ +/* 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 (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 + + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + +#include +#include + + +int main( int argc , char** argv ) +{ + std::cout << "This program create a Gnuplot script to plot persistence vector. Please call this program with the name of file with persistence vector. \n"; + if ( argc != 2 ) + { + std::cout << "Wrong number of parameters, the program will now terminate. \n"; + return 1; + } + Vector_distances_in_diagram< euclidean_distance > l; + l.load_from_file( argv[1] ); + l.plot( argv[1] ); + + return 0; +} + -- cgit v1.2.3 From 318c309206f1cffcc17c9333bb6ac9e2f90b7610 Mon Sep 17 00:00:00 2001 From: pdlotko Date: Fri, 31 Mar 2017 13:22:29 +0000 Subject: solved problem with cmake. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/gudhi_stat@2294 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 34fc791c80d9e66ab18e992f73bbf3252b3d5e1e --- CMakeLists.txt | 5 + src/Gudhi_stat/include/gudhi/bootstrap.h | 17 ++- src/Gudhi_stat/utilities/CMakeLists.txt | 103 +------------------ src/Gudhi_stat/utilities/Hausdorff_bootstrap.cpp | 81 --------------- src/Gudhi_stat/utilities/Hausdorff_subsampling.cpp | 114 +++++++++++++++++++++ .../utilities/persistence_heat_maps/CMakeLists.txt | 31 ++++++ .../utilities/persistence_intervals/CMakeLists.txt | 22 ++++ .../plot_persistence_intervals.cpp | 4 +- .../persistence_landscapes/CMakeLists.txt | 21 ++++ .../persistence_landscapes_on_grid/CMakeLists.txt | 22 ++++ .../utilities/persistence_vectors/CMakeLists.txt | 20 ++++ 11 files changed, 254 insertions(+), 186 deletions(-) delete mode 100644 src/Gudhi_stat/utilities/Hausdorff_bootstrap.cpp create mode 100644 src/Gudhi_stat/utilities/Hausdorff_subsampling.cpp create mode 100644 src/Gudhi_stat/utilities/persistence_heat_maps/CMakeLists.txt create mode 100644 src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt create mode 100644 src/Gudhi_stat/utilities/persistence_landscapes/CMakeLists.txt create mode 100644 src/Gudhi_stat/utilities/persistence_landscapes_on_grid/CMakeLists.txt create mode 100644 src/Gudhi_stat/utilities/persistence_vectors/CMakeLists.txt (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 488f1d62..bb412421 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,6 +146,11 @@ else() add_subdirectory(src/Gudhi_stat/test) add_subdirectory(src/Gudhi_stat/example) add_subdirectory(src/Gudhi_stat/utilities) + add_subdirectory(src/Gudhi_stat/utilities/persistence_heat_maps) + add_subdirectory(src/Gudhi_stat/utilities/persistence_intervals) + add_subdirectory(src/Gudhi_stat/utilities/persistence_landscapes) + add_subdirectory(src/Gudhi_stat/utilities/persistence_landscapes_on_grid) + add_subdirectory(src/Gudhi_stat/utilities/persistence_vectors) # data points generator add_subdirectory(data/points/generator) diff --git a/src/Gudhi_stat/include/gudhi/bootstrap.h b/src/Gudhi_stat/include/gudhi/bootstrap.h index 629240ed..dde08130 100644 --- a/src/Gudhi_stat/include/gudhi/bootstrap.h +++ b/src/Gudhi_stat/include/gudhi/bootstrap.h @@ -1,4 +1,4 @@ -/* This file is part of the Gudhi Library. The Gudhi library +/* Thicharacteristic_of_all_pointss file is part of the Gudhi Library. The Gudhi library * (Geometric Understanding in Higher Dimensions) is a generic C++ * library for computational topology. * @@ -135,14 +135,21 @@ double bootstrap( size_t number_of_points , CharacteristicFunction f , DistanceB // ); // #endif + //size_t position_of_quantile = floor(2*(1-quantile)*vector_of_distances.size()); + + size_t position_of_quantile = floor(quantile*vector_of_distances.size()); if ( position_of_quantile ) --position_of_quantile; if ( dbg ) { - std::cout << "position_of_quantile : " << position_of_quantile << ", and here is the array : " << std::endl; + std::cerr << "quantile : " << quantile << std::endl; + std::cerr << "position_of_quantile : " << position_of_quantile << std::endl; + + std::sort( vector_of_distances.begin() , vector_of_distances.end() ); + //std::cout << "position_of_quantile : " << position_of_quantile << ", and here is the array : " << std::endl; for ( size_t i = 0 ; i != vector_of_distances.size() ; ++i ) { - std::cout << vector_of_distances[i] << std::endl; + std::cout << vector_of_distances[i] << " " ; } std::cout << std::endl; } @@ -150,6 +157,10 @@ double bootstrap( size_t number_of_points , CharacteristicFunction f , DistanceB //now we need to sort the vector_of_distances and find the quantile: std::nth_element (vector_of_distances.begin(), vector_of_distances.begin()+position_of_quantile, vector_of_distances.end()); + + //for Hausdorff bootrstra I have to multily it by 2. + //In case of other bootsraps, I do not have to do it. We need a special variable saying if Ineed this multiplication or not.//This should be done outside the bootstrap, since the fact hat we need it do not come from bootstrab, but from geometry of bottleneck distance + if ( dbg )std::cout << "Result : " << vector_of_distances[ position_of_quantile ] << std::endl; return vector_of_distances[ position_of_quantile ]; diff --git a/src/Gudhi_stat/utilities/CMakeLists.txt b/src/Gudhi_stat/utilities/CMakeLists.txt index b7989a96..235d5d2e 100644 --- a/src/Gudhi_stat/utilities/CMakeLists.txt +++ b/src/Gudhi_stat/utilities/CMakeLists.txt @@ -3,103 +3,6 @@ project(GUDHI_STAT) -#persitence diagrams -add_executable ( persistence_intervals/plot_persistence_intervals persistence_intervals/plot_persistence_intervals.cpp ) -target_link_libraries( persistence_intervals/plot_persistence_intervals ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_intervals/compute_birth_death_range_in_persistence_diagram persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp ) -target_link_libraries( persistence_intervals/compute_birth_death_range_in_persistence_diagram ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_intervals/compute_number_of_dominant_intervals persistence_intervals/compute_number_of_dominant_intervals.cpp ) -target_link_libraries( persistence_intervals/compute_number_of_dominant_intervals ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_intervals/plot_histogram_of_intervals_lengths persistence_intervals/plot_histogram_of_intervals_lengths.cpp ) -target_link_libraries( persistence_intervals/plot_histogram_of_intervals_lengths ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_intervals/plot_persistence_Betti_numebrs persistence_intervals/plot_persistence_Betti_numebrs.cpp ) -target_link_libraries( persistence_intervals/plot_persistence_Betti_numebrs ${Boost_SYSTEM_LIBRARY}) - -#when we have bottleneck and wasserstein distance computations, add suitable programs here. - - -#persitence landscapes -add_executable ( persistence_landscapes/average_landscapes persistence_landscapes/average_landscapes.cpp ) -target_link_libraries(persistence_landscapes/average_landscapes ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_landscapes/create_landscapes persistence_landscapes/create_landscapes.cpp ) -target_link_libraries(persistence_landscapes/create_landscapes ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_landscapes/plot_landscapes persistence_landscapes/plot_landscapes.cpp ) -target_link_libraries(persistence_landscapes/plot_landscapes ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_landscapes/compute_distance_of_landscapes persistence_landscapes/compute_distance_of_landscapes.cpp ) -target_link_libraries(persistence_landscapes/compute_distance_of_landscapes ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_landscapes/compute_scalar_product_of_landscapes persistence_landscapes/compute_scalar_product_of_landscapes.cpp ) -target_link_libraries(persistence_landscapes/compute_scalar_product_of_landscapes ${Boost_SYSTEM_LIBRARY}) - -#persitence landscapes on a grid -add_executable ( persistence_landscapes_on_grid/average_landscapes_on_grid persistence_landscapes_on_grid/average_landscapes_on_grid.cpp ) -target_link_libraries(persistence_landscapes_on_grid/average_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_landscapes_on_grid/create_landscapes_on_grid persistence_landscapes_on_grid/create_landscapes_on_grid.cpp ) -target_link_libraries(persistence_landscapes_on_grid/create_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_landscapes_on_grid/plot_landscapes_on_grid persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp ) -target_link_libraries(persistence_landscapes_on_grid/plot_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp ) -target_link_libraries(persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp ) -target_link_libraries(persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) - -#persitence heat maps -add_executable ( persistence_heat_maps/average_persistence_heat_maps persistence_heat_maps/average_persistence_heat_maps.cpp ) -target_link_libraries(persistence_heat_maps/average_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_heat_maps/create_persistence_heat_maps persistence_heat_maps/create_persistence_heat_maps.cpp ) -target_link_libraries(persistence_heat_maps/create_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_heat_maps/plot_persistence_heat_map persistence_heat_maps/plot_persistence_heat_map.cpp ) -target_link_libraries(persistence_heat_maps/plot_persistence_heat_map ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_heat_maps/compute_distance_of_persistence_heat_maps persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp ) -target_link_libraries(persistence_heat_maps/compute_distance_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp ) -target_link_libraries(persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_heat_maps/create_pssk persistence_heat_maps/create_pssk.cpp ) -target_link_libraries(persistence_heat_maps/create_pssk ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp ) -target_link_libraries(persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp ) -target_link_libraries(persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp ) -target_link_libraries(persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence ${Boost_SYSTEM_LIBRARY}) - - -#persitence vectors -add_executable ( persistence_vectors/average_persistence_vectors persistence_vectors/average_persistence_vectors.cpp ) -target_link_libraries(persistence_vectors/average_persistence_vectors ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_vectors/create_persistence_vectors persistence_vectors/create_persistence_vectors.cpp ) -target_link_libraries(persistence_vectors/create_persistence_vectors ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_vectors/compute_distance_of_persistence_vectors persistence_vectors/compute_distance_of_persistence_vectors.cpp ) -target_link_libraries(persistence_vectors/compute_distance_of_persistence_vectors ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_vectors/compute_scalar_product_of_persistence_vectors persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp ) -target_link_libraries(persistence_vectors/compute_scalar_product_of_persistence_vectors ${Boost_SYSTEM_LIBRARY}) - -add_executable ( persistence_vectors/plot_persistence_vectors persistence_vectors/plot_persistence_vectors.cpp ) -target_link_libraries(persistence_vectors/plot_persistence_vectors ${Boost_SYSTEM_LIBRARY}) - - #some stat libraries: add_executable ( permutation_test permutation_test.cpp ) target_link_libraries(permutation_test ${Boost_SYSTEM_LIBRARY}) @@ -110,11 +13,11 @@ target_link_libraries(permutation_test ${Boost_SYSTEM_LIBRARY}) #add_executable ( topological_process_2 topological_process_2.cpp ) #target_link_libraries(topological_process_2 ${Boost_SYSTEM_LIBRARY}) -add_executable ( Hausdorff_bootstrap Hausdorff_bootstrap.cpp ) +add_executable ( Hausdorff_subsampling Hausdorff_subsampling.cpp ) if (TBB_FOUND) -target_link_libraries(Hausdorff_bootstrap ${TBB_LIBRARIES}) +target_link_libraries(Hausdorff_subsampling ${TBB_LIBRARIES}) endif(TBB_FOUND) -target_link_libraries(Hausdorff_bootstrap ${Boost_SYSTEM_LIBRARY}) +target_link_libraries(Hausdorff_subsampling ${Boost_SYSTEM_LIBRARY}) add_executable ( Landscape_bootstrap Landscape_bootstrap.cpp ) diff --git a/src/Gudhi_stat/utilities/Hausdorff_bootstrap.cpp b/src/Gudhi_stat/utilities/Hausdorff_bootstrap.cpp deleted file mode 100644 index 7fd665c3..00000000 --- a/src/Gudhi_stat/utilities/Hausdorff_bootstrap.cpp +++ /dev/null @@ -1,81 +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 (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 -#include - - -using namespace Gudhi; -using namespace Gudhi::Gudhi_stat; - - - -int main( int argc , char** argv ) -{ - std::cout << "The parameters of this program are : " << std::endl; - std::cout << "(a) a name of a file with points," << std:: endl; - std::cout << "(b) a number of repetitions of bootstrap (integer)," << std::endl; - std::cout << "(c) a size of subsample (integer, smaller than the number of points," << std::endl; - std::cout << "(d) a quantile (real number between 0 and 1. If you do not know what to set, set it to 0.95." << std::endl; - if ( argc != 5 ) - { - std::cerr << "Wrong number of parameters, the program will now terminate.\n"; - return 1; - } - - const char* filename = argv[1]; - size_t number_of_repetitions_of_bootstrap = (size_t)atoi( argv[2] ); - size_t size_of_subsample = (size_t)atoi( argv[3] ); - double quantile = atof( argv[4] ); - - std::cout << "Now we will read points from the file : " << filename << " and then perform " << number_of_repetitions_of_bootstrap << " times the bootstrap on it by choosing subsample of a size " << size_of_subsample << std::endl; - - std::vector< std::vector< double > > points = read_numbers_from_file_line_by_line( filename ); - - std::cout << "Read : " << points.size() << " points.\n"; - - //comute all-to-all distance matrix: - std::vector< std::vector > all_to_all_distance_matrix_between_points = compute_all_to_all_distance_matrix_between_points< std::vector , Euclidean_distance >( points ); - Hausdorff_distance_between_subspace_and_the_whole_metric_space distance( all_to_all_distance_matrix_between_points ); - identity< std::vector > identity_char; - - //and now we can run the real bootstrap. - //template < typename PointCloudCharacteristics , typename CharacteristicFunction , typename DistanceBetweenPointsCharacteristics > - //In this case, the PointCloudCharacteristics is just a vector of numbers of points (in a order fixed on points vector). - //CharacteristicFunction is just identity, transforming std::vector< size_t > to itself. - //DistanceBetweenPointsCharacteristics is the place were all happens. This class have the information about the coordinates of the points, and allows to compute a Hausdorff distance between - //the collection of all points, and the subsample. - double result = bootstrap< - std::vector< size_t > , //PointCloudCharacteristics - identity< std::vector > , //CharacteristicFunction - Hausdorff_distance_between_subspace_and_the_whole_metric_space //DistanceBetweenPointsCharacteristics. This function have the information about point's coordinates. - > - ( points.size() , identity_char , distance , number_of_repetitions_of_bootstrap , size_of_subsample , quantile ); - - std::cout << "result of bootstrap : " << result << std::endl; - - - return 0; -} diff --git a/src/Gudhi_stat/utilities/Hausdorff_subsampling.cpp b/src/Gudhi_stat/utilities/Hausdorff_subsampling.cpp new file mode 100644 index 00000000..5556a8ee --- /dev/null +++ b/src/Gudhi_stat/utilities/Hausdorff_subsampling.cpp @@ -0,0 +1,114 @@ +/* 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 (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 +#include + + +using namespace Gudhi; +using namespace Gudhi::Gudhi_stat; + + + +int main( int argc , char** argv ) +{ + std::cout << "The parameters of this program are : " << std::endl; + std::cout << "(a) a name of a file with points," << std:: endl; + std::cout << "(b) a number of repetitions of bootstrap (integer)," << std::endl; + std::cout << "(c) a size of subsample (integer, smaller than the number of points," << std::endl; + std::cout << "(d) a quantile (real number between 0 and 1. If you do not know what to set, set it to 0.95." << std::endl; + if ( argc != 5 ) + { + std::cerr << "Wrong number of parameters, the program will now terminate.\n"; + return 1; + } + + const char* filename = argv[1]; + size_t number_of_repetitions_of_subsampling = (size_t)atoi( argv[2] ); + size_t size_of_subsample = (size_t)atoi( argv[3] ); + double quantile = atof( argv[4] ); + + std::cout << "Now we will read points from the file : " << filename << " and then perform " << number_of_repetitions_of_subsampling << " times the subsampling on it by choosing subsample of a size " << size_of_subsample << std::endl; + + std::vector< std::vector< double > > points = read_numbers_from_file_line_by_line( filename ); + /* + std::vector< std::vector< double > > points; + std::vector< double > point1(2); + point1[0] = -1; + point1[1] = 0; + std::vector< double > point2(2); + point2[0] = 1; + point2[1] = 0; + std::vector< double > point3(2); + point3[0] = -1; + point3[1] = 3; + std::vector< double > point4(2); + point4[0] = 1; + point4[1] = 3; + points.push_back( point1 ); + points.push_back( point2 ); + points.push_back( point3 ); + points.push_back( point4 ); + + + std::vector< std::vector > all_to_all_distance_matrix_between_points = compute_all_to_all_distance_matrix_between_points< std::vector , Euclidean_distance >( points ); + Hausdorff_distance_between_subspace_and_the_whole_metric_space distance( all_to_all_distance_matrix_between_points ); + + std::vector characteristic_of_all_points = {0,1,2,3}; + std::vector characteristic_of_subsampled_points = {2,3}; + std::cerr << "DISTANCE BETWEEN SAMPLE AND SUBSAMPLE: " << distance( characteristic_of_subsampled_points , characteristic_of_all_points ) << std::endl; + */ + + + std::cout << "Read : " << points.size() << " points.\n"; + + //comute all-to-all distance matrix: + std::vector< std::vector > all_to_all_distance_matrix_between_points = compute_all_to_all_distance_matrix_between_points< std::vector , Euclidean_distance >( points ); + Hausdorff_distance_between_subspace_and_the_whole_metric_space distance( all_to_all_distance_matrix_between_points ); + identity< std::vector > identity_char; + + + + + + + //and now we can run the real bootstrap. + //template < typename PointCloudCharacteristics , typename CharacteristicFunction , typename DistanceBetweenPointsCharacteristics > + //In this case, the PointCloudCharacteristics is just a vector of numbers of points (in a order fixed on points vector). + //CharacteristicFunction is just identity, transforming std::vector< size_t > to itself. + //DistanceBetweenPointsCharacteristics is the place were all happens. This class have the information about the coordinates of the points, and allows to compute a Hausdorff distance between + //the collection of all points, and the subsample. + double result = bootstrap< + std::vector< size_t > , //PointCloudCharacteristics + identity< std::vector > , //CharacteristicFunction + Hausdorff_distance_between_subspace_and_the_whole_metric_space //DistanceBetweenPointsCharacteristics. This function have the information about point's coordinates. + > + ( points.size() , identity_char , distance , number_of_repetitions_of_subsampling , size_of_subsample , quantile ); + + std::cout << "result of the subsampling : " << result << std::endl; + + + return 0; +} diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/CMakeLists.txt b/src/Gudhi_stat/utilities/persistence_heat_maps/CMakeLists.txt new file mode 100644 index 00000000..39240db2 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_heat_maps/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 2.6) +project(GUDHI_STAT) + +#persitence heat maps +add_executable ( average_persistence_heat_maps average_persistence_heat_maps.cpp ) +target_link_libraries(average_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) + +add_executable ( create_persistence_heat_maps create_persistence_heat_maps.cpp ) +target_link_libraries(create_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) + +add_executable ( plot_persistence_heat_map plot_persistence_heat_map.cpp ) +target_link_libraries(plot_persistence_heat_map ${Boost_SYSTEM_LIBRARY}) + +add_executable ( compute_distance_of_persistence_heat_maps compute_distance_of_persistence_heat_maps.cpp ) +target_link_libraries(compute_distance_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) + +add_executable ( compute_scalar_product_of_persistence_heat_maps compute_scalar_product_of_persistence_heat_maps.cpp ) +target_link_libraries(compute_scalar_product_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY}) + +add_executable ( create_pssk create_pssk.cpp ) +target_link_libraries(create_pssk ${Boost_SYSTEM_LIBRARY}) + +add_executable ( create_persistence_heat_maps_weighted_by_distance_from_diagonal create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp ) +target_link_libraries(create_persistence_heat_maps_weighted_by_distance_from_diagonal ${Boost_SYSTEM_LIBRARY}) + +add_executable ( create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp ) +target_link_libraries(create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal ${Boost_SYSTEM_LIBRARY}) + +add_executable ( create_persistence_heat_maps_weighted_by_arctan_of_their_persistence create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp ) +target_link_libraries(create_persistence_heat_maps_weighted_by_arctan_of_their_persistence ${Boost_SYSTEM_LIBRARY}) + diff --git a/src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt b/src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt new file mode 100644 index 00000000..96cb1a5e --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 2.6) +project(GUDHI_STAT) + + + +#persitence diagrams +add_executable ( plot_persistence_intervals plot_persistence_intervals.cpp ) +target_link_libraries( plot_persistence_intervals ${Boost_SYSTEM_LIBRARY}) + +add_executable ( compute_birth_death_range_in_persistence_diagram compute_birth_death_range_in_persistence_diagram.cpp ) +target_link_libraries( compute_birth_death_range_in_persistence_diagram ${Boost_SYSTEM_LIBRARY}) + +add_executable ( compute_number_of_dominant_intervals compute_number_of_dominant_intervals.cpp ) +target_link_libraries( compute_number_of_dominant_intervals ${Boost_SYSTEM_LIBRARY}) + +add_executable ( plot_histogram_of_intervals_lengths plot_histogram_of_intervals_lengths.cpp ) +target_link_libraries( plot_histogram_of_intervals_lengths ${Boost_SYSTEM_LIBRARY}) + +add_executable ( plot_persistence_Betti_numebrs plot_persistence_Betti_numebrs.cpp ) +target_link_libraries( plot_persistence_Betti_numebrs ${Boost_SYSTEM_LIBRARY}) + +#when we have bottleneck and wasserstein distance computations, add suitable programs here. diff --git a/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_intervals.cpp b/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_intervals.cpp index 40f6fbaf..04a05caa 100644 --- a/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_intervals.cpp +++ b/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_intervals.cpp @@ -44,8 +44,8 @@ int main( int argc , char** argv ) std::cout << "To run this program, please provide the name of a file with persistence diagram \n"; return 1; } - - Persistence_intervals b( argv[1] ); + std::vector< std::pair< double , double > > intervals = read_gudhi_file( argv[1] , 2 ); + Persistence_intervals b( intervals ); b.plot( argv[1] ); return 0; } diff --git a/src/Gudhi_stat/utilities/persistence_landscapes/CMakeLists.txt b/src/Gudhi_stat/utilities/persistence_landscapes/CMakeLists.txt new file mode 100644 index 00000000..9caf73f6 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_landscapes/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 2.6) +project(GUDHI_STAT) + + + +#persitence landscapes +add_executable ( average_landscapes average_landscapes.cpp ) +target_link_libraries(average_landscapes ${Boost_SYSTEM_LIBRARY}) + +add_executable ( create_landscapes create_landscapes.cpp ) +target_link_libraries(create_landscapes ${Boost_SYSTEM_LIBRARY}) + +add_executable ( plot_landscapes plot_landscapes.cpp ) +target_link_libraries(plot_landscapes ${Boost_SYSTEM_LIBRARY}) + +add_executable ( compute_distance_of_landscapes compute_distance_of_landscapes.cpp ) +target_link_libraries(compute_distance_of_landscapes ${Boost_SYSTEM_LIBRARY}) + +add_executable ( compute_scalar_product_of_landscapes compute_scalar_product_of_landscapes.cpp ) +target_link_libraries(compute_scalar_product_of_landscapes ${Boost_SYSTEM_LIBRARY}) + diff --git a/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/CMakeLists.txt b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/CMakeLists.txt new file mode 100644 index 00000000..bb7c3987 --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 2.6) +project(GUDHI_STAT) + + + + +#persitence landscapes on a grid +add_executable ( average_landscapes_on_grid average_landscapes_on_grid.cpp ) +target_link_libraries(average_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) + +add_executable ( create_landscapes_on_grid create_landscapes_on_grid.cpp ) +target_link_libraries(create_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) + +add_executable ( plot_landscapes_on_grid plot_landscapes_on_grid.cpp ) +target_link_libraries(plot_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) + +add_executable ( compute_distance_of_landscapes_on_grid compute_distance_of_landscapes_on_grid.cpp ) +target_link_libraries(compute_distance_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) + +add_executable ( compute_scalar_product_of_landscapes_on_grid compute_scalar_product_of_landscapes_on_grid.cpp ) +target_link_libraries(compute_scalar_product_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY}) + diff --git a/src/Gudhi_stat/utilities/persistence_vectors/CMakeLists.txt b/src/Gudhi_stat/utilities/persistence_vectors/CMakeLists.txt new file mode 100644 index 00000000..ebf4898e --- /dev/null +++ b/src/Gudhi_stat/utilities/persistence_vectors/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 2.6) +project(GUDHI_STAT) + +#persitence vectors +add_executable ( average_persistence_vectors average_persistence_vectors.cpp ) +target_link_libraries(average_persistence_vectors ${Boost_SYSTEM_LIBRARY}) + +add_executable ( create_persistence_vectors create_persistence_vectors.cpp ) +target_link_libraries(create_persistence_vectors ${Boost_SYSTEM_LIBRARY}) + +add_executable ( compute_distance_of_persistence_vectors compute_distance_of_persistence_vectors.cpp ) +target_link_libraries(compute_distance_of_persistence_vectors ${Boost_SYSTEM_LIBRARY}) + +add_executable ( compute_scalar_product_of_persistence_vectors compute_scalar_product_of_persistence_vectors.cpp ) +target_link_libraries(compute_scalar_product_of_persistence_vectors ${Boost_SYSTEM_LIBRARY}) + +add_executable ( plot_persistence_vectors plot_persistence_vectors.cpp ) +target_link_libraries(plot_persistence_vectors ${Boost_SYSTEM_LIBRARY}) + + -- cgit v1.2.3