summaryrefslogtreecommitdiff
path: root/src/Gudhi_stat/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'src/Gudhi_stat/utilities')
-rw-r--r--src/Gudhi_stat/utilities/CMakeLists.txt103
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp73
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp107
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp91
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp79
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp79
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp79
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp79
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/create_pssk.cpp77
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp44
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp72
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp57
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp69
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp93
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_intervals.cpp59
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes/average_landscapes.cpp75
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp109
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp92
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes/create_landscapes.cpp56
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes/plot_landscapes.cpp50
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp74
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp107
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp91
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp80
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp55
-rw-r--r--src/Gudhi_stat/utilities/persistence_vectors/average_persistence_vectors.cpp75
-rw-r--r--src/Gudhi_stat/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp108
-rw-r--r--src/Gudhi_stat/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp97
-rw-r--r--src/Gudhi_stat/utilities/persistence_vectors/create_persistence_vectors.cpp57
-rw-r--r--src/Gudhi_stat/utilities/persistence_vectors/plot_persistence_vectors.cpp51
30 files changed, 2338 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_heat_maps.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+
+
+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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_heat_maps.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_heat_maps.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_heat_maps.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+
+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<double> > 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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_heat_maps.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+
+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<double> > 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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_heat_maps.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+
+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<double> > 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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_heat_maps.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+
+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<double> > 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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/PSSK.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+
+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<double> > 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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_heat_maps.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/reader_utils.h>
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_intervals.h>
+
+#include <iostream>
+#include <vector>
+#include <limits>
+
+
+
+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<double,double> 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<double>::max();
+ double max_ = -std::numeric_limits<double>::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<double,double> 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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/reader_utils.h>
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_intervals.h>
+
+#include <iostream>
+
+
+
+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<double,double> > 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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/reader_utils.h>
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_intervals.h>
+
+#include <iostream>
+
+
+
+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<double,double> > 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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/reader_utils.h>
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_intervals.h>
+
+#include <iostream>
+
+
+
+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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/reader_utils.h>
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_intervals.h>
+
+#include <iostream>
+
+
+
+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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_landscape.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+
+
+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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_landscape.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_landscape.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_landscape.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_landscape.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_landscape_on_grid.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+
+
+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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_landscape_on_grid.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_landscape_on_grid.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_landscape_on_grid.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_landscape_on_grid.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Vector_distances_in_diagram.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+
+
+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<double> >* l = new Vector_distances_in_diagram< euclidean_distance<double> >;
+ l->load_from_file( filenames[i] );
+ lands.push_back( (Abs_Topological_data_with_averages*)l );
+ }
+
+ Vector_distances_in_diagram< euclidean_distance<double> > 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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Vector_distances_in_diagram.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+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<double> >* > 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<double> >* l = new Vector_distances_in_diagram< euclidean_distance<double> >;
+ 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<double> >*)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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Vector_distances_in_diagram.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+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<double> >* > vectors;
+ vectors.reserve( filenames.size() );
+ for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no )
+ {
+ Vector_distances_in_diagram< euclidean_distance<double> >* l = new Vector_distances_in_diagram< euclidean_distance<double> >;
+ 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<double> >*)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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Vector_distances_in_diagram.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+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<double> > 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 <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Vector_distances_in_diagram.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+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<double> > l;
+ l.load_from_file( argv[1] );
+ l.plot( argv[1] );
+
+ return 0;
+}
+