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.txt53
-rw-r--r--src/Gudhi_stat/utilities/Hausdorff_subsampling.cpp112
-rw-r--r--src/Gudhi_stat/utilities/Landscape_bootstrap.cpp185
-rw-r--r--src/Gudhi_stat/utilities/Multiplicative_bootstrap.cpp69
-rw-r--r--src/Gudhi_stat/utilities/permutation_test.cpp83
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/CMakeLists.txt31
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp72
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp111
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp89
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp78
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp78
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp77
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp77
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/create_pssk.cpp74
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp42
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt22
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp69
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp54
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp66
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp90
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_intervals.cpp58
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes/CMakeLists.txt21
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes/average_landscapes.cpp74
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp112
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp89
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes/create_landscapes.cpp53
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes/plot_landscapes.cpp47
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes_on_grid/CMakeLists.txt22
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp71
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp110
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp89
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp77
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp52
-rw-r--r--src/Gudhi_stat/utilities/persistence_vectors/CMakeLists.txt20
-rw-r--r--src/Gudhi_stat/utilities/persistence_vectors/average_persistence_vectors.cpp73
-rw-r--r--src/Gudhi_stat/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp111
-rw-r--r--src/Gudhi_stat/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp87
-rw-r--r--src/Gudhi_stat/utilities/persistence_vectors/create_persistence_vectors.cpp55
-rw-r--r--src/Gudhi_stat/utilities/persistence_vectors/plot_persistence_vectors.cpp48
-rw-r--r--src/Gudhi_stat/utilities/sliding_window_embedding.cpp40
40 files changed, 2841 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..235d5d2e
--- /dev/null
+++ b/src/Gudhi_stat/utilities/CMakeLists.txt
@@ -0,0 +1,53 @@
+cmake_minimum_required(VERSION 2.6)
+project(GUDHI_STAT)
+
+
+
+#some stat libraries:
+add_executable ( permutation_test permutation_test.cpp )
+target_link_libraries(permutation_test ${Boost_SYSTEM_LIBRARY})
+
+#add_executable ( topological_process topological_process.cpp )
+#target_link_libraries(topological_process ${Boost_SYSTEM_LIBRARY})
+
+#add_executable ( topological_process_2 topological_process_2.cpp )
+#target_link_libraries(topological_process_2 ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( Hausdorff_subsampling Hausdorff_subsampling.cpp )
+if (TBB_FOUND)
+target_link_libraries(Hausdorff_subsampling ${TBB_LIBRARIES})
+endif(TBB_FOUND)
+target_link_libraries(Hausdorff_subsampling ${Boost_SYSTEM_LIBRARY})
+
+
+add_executable ( Landscape_bootstrap Landscape_bootstrap.cpp )
+if (TBB_FOUND)
+target_link_libraries(Landscape_bootstrap ${TBB_LIBRARIES})
+endif(TBB_FOUND)
+target_link_libraries(Landscape_bootstrap ${Boost_SYSTEM_LIBRARY})
+
+
+add_executable ( Multiplicative_bootstrap Multiplicative_bootstrap.cpp )
+if (TBB_FOUND)
+target_link_libraries(Multiplicative_bootstrap ${TBB_LIBRARIES})
+endif(TBB_FOUND)
+target_link_libraries(Multiplicative_bootstrap ${Boost_SYSTEM_LIBRARY})
+
+
+
+
+#just for Pawel's tests:
+#add_executable ( NN_classification NN_classification.cpp )
+#target_link_libraries(NN_classification ${Boost_SYSTEM_LIBRARY})
+#
+#add_executable ( compute_distance_between_vectors compute_distance_between_vectors.cpp )
+#target_link_libraries(compute_distance_between_vectors ${Boost_SYSTEM_LIBRARY})
+
+
+if(CGAL_FOUND)
+ add_executable ( sliding_window_embedding sliding_window_embedding.cpp )
+ target_link_libraries(sliding_window_embedding ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
+ if (TBB_FOUND)
+ target_link_libraries(sliding_window_embedding ${TBB_LIBRARIES})
+ endif(TBB_FOUND)
+endif(CGAL_FOUND)
diff --git a/src/Gudhi_stat/utilities/Hausdorff_subsampling.cpp b/src/Gudhi_stat/utilities/Hausdorff_subsampling.cpp
new file mode 100644
index 00000000..5c3be0cc
--- /dev/null
+++ b/src/Gudhi_stat/utilities/Hausdorff_subsampling.cpp
@@ -0,0 +1,112 @@
+/* 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/Hausdorff_distances.h>
+#include <gudhi/bootstrap.h>
+#include <gudhi/read_persitence_from_file.h>
+#include <gudhi/persistence_representations/Vector_distances_in_diagram.h>
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "The parameters of this program are : " << std::endl;
+ std::cout << "(a) a name of a file with points," << std:: endl;
+ std::cout << "(b) a number of repetitions of bootstrap (integer)," << std::endl;
+ std::cout << "(c) a size of subsample (integer, smaller than the number of points," << std::endl;
+ std::cout << "(d) a quantile (real number between 0 and 1. If you do not know what to set, set it to 0.95." << std::endl;
+ if ( argc != 5 )
+ {
+ std::cerr << "Wrong number of parameters, the program will now terminate.\n";
+ return 1;
+ }
+
+ const char* filename = argv[1];
+ size_t number_of_repetitions_of_subsampling = (size_t)atoi( argv[2] );
+ size_t size_of_subsample = (size_t)atoi( argv[3] );
+ double quantile = atof( argv[4] );
+
+ std::cout << "Now we will read points from the file : " << filename << " and then perform " << number_of_repetitions_of_subsampling << " times the subsampling on it by choosing subsample of a size " << size_of_subsample << std::endl;
+
+ std::vector< std::vector< double > > points = read_numbers_from_file_line_by_line( filename );
+ /*
+ std::vector< std::vector< double > > points;
+ std::vector< double > point1(2);
+ point1[0] = -1;
+ point1[1] = 0;
+ std::vector< double > point2(2);
+ point2[0] = 1;
+ point2[1] = 0;
+ std::vector< double > point3(2);
+ point3[0] = -1;
+ point3[1] = 3;
+ std::vector< double > point4(2);
+ point4[0] = 1;
+ point4[1] = 3;
+ points.push_back( point1 );
+ points.push_back( point2 );
+ points.push_back( point3 );
+ points.push_back( point4 );
+ size_of_subsample = 2;
+ */
+// std::vector< std::vector<double> > all_to_all_distance_matrix_between_points = compute_all_to_all_distance_matrix_between_points< std::vector<double> , Euclidean_distance<double> >( points );
+// Hausdorff_distance_between_subspace_and_the_whole_metric_space distance( all_to_all_distance_matrix_between_points );
+
+
+ std::cout << "Read : " << points.size() << " points.\n";
+
+ //comute all-to-all distance matrix:
+ std::vector< std::vector<double> > all_to_all_distance_matrix_between_points = compute_all_to_all_distance_matrix_between_points< std::vector<double> , Euclidean_distance<double> >( points );
+ Hausdorff_distance_between_subspace_and_the_whole_metric_space distance( all_to_all_distance_matrix_between_points );
+ identity< std::vector<size_t> > identity_char;
+
+// std::vector<size_t> characteristic_of_all_points = {0,1,2,3};
+// std::vector<size_t> characteristic_of_subsampled_points = {2,3};
+// std::cerr << "DISTANCE BETWEEN SAMPLE AND SUBSAMPLE: " << distance( characteristic_of_subsampled_points , characteristic_of_all_points ) << std::endl;
+
+
+
+
+
+ //and now we can run the real bootstrap.
+ //template < typename PointCloudCharacteristics , typename CharacteristicFunction , typename DistanceBetweenPointsCharacteristics >
+ //In this case, the PointCloudCharacteristics is just a vector of numbers of points (in a order fixed on points vector).
+ //CharacteristicFunction is just identity, transforming std::vector< size_t > to itself.
+ //DistanceBetweenPointsCharacteristics is the place were all happens. This class have the information about the coordinates of the points, and allows to compute a Hausdorff distance between
+ //the collection of all points, and the subsample.
+ double result = bootstrap<
+ std::vector< size_t > , //PointCloudCharacteristics
+ identity< std::vector<size_t> > , //CharacteristicFunction
+ Hausdorff_distance_between_subspace_and_the_whole_metric_space //DistanceBetweenPointsCharacteristics. This function have the information about point's coordinates.
+ >
+ ( points.size() , identity_char , distance , number_of_repetitions_of_subsampling , size_of_subsample , quantile );
+
+ std::cout << "result of the subsampling : " << 2*result << std::endl;
+
+
+ return 0;
+}
diff --git a/src/Gudhi_stat/utilities/Landscape_bootstrap.cpp b/src/Gudhi_stat/utilities/Landscape_bootstrap.cpp
new file mode 100644
index 00000000..e6e96e68
--- /dev/null
+++ b/src/Gudhi_stat/utilities/Landscape_bootstrap.cpp
@@ -0,0 +1,185 @@
+/* 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/>.
+ */
+
+//stat part:
+#include <gudhi/Hausdorff_distances.h>
+#include <gudhi/bootstrap.h>
+#include <gudhi/persistence_representations/Persistence_landscape.h>
+#include <gudhi/read_persitence_from_file.h>
+#include <gudhi/persistence_representations/Vector_distances_in_diagram.h>
+//persistence part:
+#include <gudhi/reader_utils.h>
+#include <gudhi/Rips_complex.h>
+#include <gudhi/distance_functions.h>
+#include <gudhi/Simplex_tree.h>
+#include <gudhi/Persistent_cohomology.h>
+
+
+
+using Persistence_landscape = Gudhi::Gudhi_stat::Persistence_landscape;
+
+typedef int Vertex_handle;
+typedef double Filtration_value;
+
+
+//if this variable is -1, then the infinite interals are ignored. If not, they infinite values are replaced with what_to_replace_infinite_intervals_with:
+double what_to_replace_infinite_intervals_with = -1;
+
+
+
+class compute_persistence_landscape_of_a_point_cloud_in_certain_dimension
+{
+public:
+ compute_persistence_landscape_of_a_point_cloud_in_certain_dimension( std::vector< std::vector< double > >& points_ , int dimension , double threshold_ , int coeficient_field_ = 11 , double min_persistence_ = 0 ):dim( dimension ),points(points_),threshold(threshold_),coeficient_field(coeficient_field_),min_persistence(min_persistence_){}
+ //This function takes a vector of indices (numbers_to_sample). It will select the points from this->points having those indices, construct Rips complex and persistence intervals based on this.
+ //Then it will filter the intervals to find only those in the dimension this->dim, and construct a persistence landascape based on this. Thie will be the result of the procedure.
+ Persistence_landscape operator()( std::vector< size_t > numbers_to_sample )
+ {
+ bool dbg = false;
+ //take the subsampled points:
+ std::vector< std::vector< double > > points_in_subsample;
+ points_in_subsample.reserve( numbers_to_sample.size() );
+ for ( size_t i = 0 ; i != numbers_to_sample.size() ; ++i )
+ {
+ points_in_subsample.push_back( this->points[ numbers_to_sample[i] ] );
+ }
+
+ using Stree = Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_fast_persistence>;
+ using Filtration_value = Stree::Filtration_value;
+ using Rips_complex = Gudhi::rips_complex::Rips_complex<Filtration_value>;
+ //construct a Rips complex based on it and compute its persistence:
+ Rips_complex rips_complex(points_in_subsample, this->threshold, Euclidean_distance());
+ // Construct the Rips complex in a Simplex Tree
+ Stree st;
+ // expand the graph until dimension dim_max
+ rips_complex.create_complex(st, this->dim + 1);
+ // Compute the persistence diagram of the complex
+ Gudhi::persistent_cohomology::Persistent_cohomology<Stree, Gudhi::persistent_cohomology::Field_Zp > pcoh(st);
+ // initializes the coefficient field for homology
+ pcoh.init_coefficients( this->coeficient_field );
+ pcoh.compute_persistent_cohomology(this->min_persistence);
+ auto persistence_pairs = pcoh.get_persistent_pairs();
+ //From the persistence take only this in the dimension this->dim:
+
+ if ( dbg )std::cerr << "Here are the persistence pairs :\n";
+ std::vector< std::pair< double,double > > persistence_in_fixed_dimension;
+ for ( size_t i = 0 ; i != persistence_pairs.size() ; ++i )
+ {
+ if ( st.dimension( std::get<0>(persistence_pairs[i]) ) == this->dim )
+ {
+ double birth = st.filtration( std::get<0>(persistence_pairs[i]) );
+ double death = st.filtration( std::get<1>(persistence_pairs[i]) );
+
+ if ( std::get<1>(persistence_pairs[i]) != st.null_simplex() )
+ {
+ //finite interval
+ persistence_in_fixed_dimension.push_back( std::pair<double,double>( birth , death ) );
+ if (dbg){std::cout << "birth : " << birth << " , death : " << death << std::endl;}
+ }
+ else
+ {
+ //infinite interval
+ if ( what_to_replace_infinite_intervals_with != -1 )
+ {
+ persistence_in_fixed_dimension.push_back( std::pair<double,double>( birth , what_to_replace_infinite_intervals_with ) );
+ if (dbg){std::cout << "birth : " << birth << " , death : " << what_to_replace_infinite_intervals_with << std::endl;}
+ }
+ }
+ }
+ }
+ if ( dbg )std::cerr << "Persistence pairs computed \n";
+ //Construct and return the persistence landscape:
+ return Persistence_landscape( persistence_in_fixed_dimension );
+ }
+private:
+ int dim;
+ std::vector< std::vector< double > >& points;
+ double threshold;
+ int coeficient_field;
+ double min_persistence;
+};
+
+class distance_between_landscapes
+{
+public:
+ distance_between_landscapes( double exponent_ ):exponent(exponent_){}
+ double operator()( const Persistence_landscape& first , const Persistence_landscape& second )
+ {
+ return first.distance( second, this->exponent );
+ }
+private:
+ double exponent;
+};
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "The parameters of this program are : " << std::endl;
+ std::cout << "(1) a name of a file with points," << std:: endl;
+ std::cout << "(2) a number of repetitions of bootstrap (integer)," << std::endl;
+ std::cout << "(3) a size of subsample (integer, smaller than the number of points. " << std::endl;
+ std::cout << "(4) An real value p such that L^p distance is going to be computed. \n";
+ std::cout << "(5) A dimension of persistence that is to be taken into account (positive integer) \n";
+ std::cout << "(6) A maximal diameter to which complex is to be grown (positive integer) \n";
+ std::cout << "(d) a quantile (real number between 0 and 1. If you do not know what to set, set it to 0.95." << std::endl;
+ if ( argc != 8 )
+ {
+ std::cerr << "Wrong number of parameters, the program will now terminate.\n";
+ return 1;
+ }
+
+ const char* filename = argv[1];
+ size_t number_of_repetitions_of_bootstrap = (size_t)atoi( argv[2] );
+ size_t size_of_subsample = (size_t)atoi( argv[3] );
+ double p = atoi( argv[4] );
+ int dimension = atoi( argv[5] );
+ double threshold = atof( argv[6] );
+ double quantile = atof( argv[7] );
+
+ std::cout << "Now we will read points from the file : " << filename << " and then perform " << number_of_repetitions_of_bootstrap << " times the bootstrap on it by choosing subsample of a size " << size_of_subsample << std::endl;
+
+ std::vector< std::vector< double > > points = Gudhi::Gudhi_stat::read_numbers_from_file_line_by_line( filename );
+
+ std::cout << "Read : " << points.size() << " points.\n";
+
+ distance_between_landscapes distance( p );//L^p distance.
+ compute_persistence_landscape_of_a_point_cloud_in_certain_dimension characteristic_fun( points , dimension , threshold );
+
+ //and now we can run the real bootstrap.
+ //template < typename PointCloudCharacteristics , typename CharacteristicFunction , typename DistanceBetweenPointsCharacteristics >
+ //In this case, the PointCloudCharacteristics is just a vector of numbers of points (in a order fixed on points vector).
+ //CharacteristicFunction is just identity, transforming std::vector< size_t > to itself.
+ //DistanceBetweenPointsCharacteristics is the place were all happens. This class hace the information about the coordinates of the points, and allows to compute a Hausdorff distance between
+ //the collection of all points, and the subsample.
+ double result = Gudhi::Gudhi_stat::bootstrap<
+ Persistence_landscape , //PointCloudCharacteristics, persistence landascapes constructed based on vector of
+ //pairs of birth--death values in a cartain dimension.
+ compute_persistence_landscape_of_a_point_cloud_in_certain_dimension , //CharacteristicFunction, in this case, we will need to compute persistence in a certain dimension.
+ distance_between_landscapes //DistanceBetweenPointsCharacteristics. In this case
+ >
+ ( points.size() , characteristic_fun , distance , number_of_repetitions_of_bootstrap , size_of_subsample , quantile );
+
+ std::cout << "result of bootstrap : " << result << std::endl;
+
+
+ return 0;
+}
diff --git a/src/Gudhi_stat/utilities/Multiplicative_bootstrap.cpp b/src/Gudhi_stat/utilities/Multiplicative_bootstrap.cpp
new file mode 100644
index 00000000..9a607251
--- /dev/null
+++ b/src/Gudhi_stat/utilities/Multiplicative_bootstrap.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/Hausdorff_distances.h>
+#include <gudhi/multiplicative_bootstrap.h>
+#include <gudhi/read_persitence_from_file.h>
+#include <gudhi/persistence_representations/Vector_distances_in_diagram.h>
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "The parameters of this program are : " << std::endl;
+ std::cout << "(a) a name of a file with names of files with persistence diagrams," << std:: endl;
+ std::cout << "(b) a number of repetitions of bootstrap (integer)," << std::endl;
+ std::cout << "(c) a quantile (real number between 0 and 1. If you do not know what to set, set it to 0.95." << std::endl;
+ if ( argc != 4 )
+ {
+ std::cerr << "Wrong number of parameters, the program will now terminate.\n";
+ return 1;
+ }
+
+ const char* file_with_filenames = argv[1];
+ size_t number_of_repetitions_of_bootstrap = (size_t)atoi( argv[2] );
+ double quantile = atof( argv[3] );
+
+ std::vector< std::string > filenames = readFileNames( file_with_filenames );
+ std::vector< Persistence_landscape* > collection_of_landscapes( filenames.size() );
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ std::vector< std::pair< double , double > > diag = read_gudhi_file( filenames[i].c_str() , 1 );//read_standard_file( filenames[i].c_str() );
+ collection_of_landscapes[i] = new Persistence_landscape( diag );
+ }
+
+ //now we can run the bootstrap:
+ difference_of_objects<Persistence_landscape> diff;
+ norm_of_objects<Persistence_landscape> norm;
+
+ double result =
+ multiplicative_bootstrap< Persistence_landscape , difference_of_objects<Persistence_landscape> , norm_of_objects<Persistence_landscape> >
+ ( collection_of_landscapes , number_of_repetitions_of_bootstrap , diff , norm , quantile , 1 );
+
+ std::cout << "result of bootstrap : " << result << std::endl;
+ return 0;
+}
+
diff --git a/src/Gudhi_stat/utilities/permutation_test.cpp b/src/Gudhi_stat/utilities/permutation_test.cpp
new file mode 100644
index 00000000..94f92d29
--- /dev/null
+++ b/src/Gudhi_stat/utilities/permutation_test.cpp
@@ -0,0 +1,83 @@
+/* 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/permutation_test.h>
+#include <gudhi/persistence_representations/Persistence_landscape.h>
+#include <iostream>
+#include <cstring>
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+int main( int argc , char** argv )
+{
+
+ std::cout << "This program require the following parameters: \n";
+ std::cout << "(1-2) Names of files each of them contains the names of files with persistence diagrams. The diagrams from a single file are assumed to be in the same group \n";
+ std::cout << "Third parameter is an integer being the number of permutations to be made \n";
+ std::cout << "The last parameter is a double, the power of a distance \n";
+ if ( argc != 5 )
+ {
+ std::cout << "Wrong number of parameters, the program will now terminat \n";
+ return 1;
+ }
+ std::cout << "We will now read the data from files : " << argv[1] << " and " << argv[2] << std::endl;
+ size_t number_of_permutations = (size_t)(atoi(argv[3]));
+ size_t exponent = (double)atof( argv[4] );
+
+ std::vector< std::string > first_group = readFileNames( argv[1] );
+ std::vector< std::string > second_group =readFileNames( argv[2] );
+
+ std::cout << "Here are the filenames in the first group :\n";
+ for ( size_t i = 0 ; i != first_group.size() ; ++i )
+ {
+ std::cout << first_group[i] << std::endl;
+ }
+ std::cout << "Here are the filenames in the second group :\n";
+ for ( size_t i = 0 ; i != second_group.size() ; ++i )
+ {
+ std::cout << second_group[i] << std::endl;
+ }
+
+ std::vector< Persistence_landscape* > first_collection( first_group.size() );
+ for ( size_t i = 0 ; i != first_group.size() ; ++i )
+ {
+ std::vector< std::pair< double , double > > diag = read_standard_file( first_group[i].c_str() );
+ Persistence_landscape* l = new Persistence_landscape( diag );
+ first_collection[i] = l;
+ }
+
+ std::vector< Persistence_landscape* > second_collection( second_group.size() );
+ for ( size_t i = 0 ; i != second_group.size() ; ++i )
+ {
+ std::vector< std::pair< double , double > > diag = read_standard_file( second_group[i].c_str() );
+ Persistence_landscape* l = new Persistence_landscape( diag );
+ second_collection[i] = l;
+ }
+
+ std::cout << "The p-value form a permutation test is : " << permutation_test<Persistence_landscape>( first_collection , second_collection , number_of_permutations , exponent ) << std::endl;
+
+
+
+ return 0;
+}
diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/CMakeLists.txt b/src/Gudhi_stat/utilities/persistence_heat_maps/CMakeLists.txt
new file mode 100644
index 00000000..39240db2
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/CMakeLists.txt
@@ -0,0 +1,31 @@
+cmake_minimum_required(VERSION 2.6)
+project(GUDHI_STAT)
+
+#persitence heat maps
+add_executable ( average_persistence_heat_maps average_persistence_heat_maps.cpp )
+target_link_libraries(average_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( create_persistence_heat_maps create_persistence_heat_maps.cpp )
+target_link_libraries(create_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( plot_persistence_heat_map plot_persistence_heat_map.cpp )
+target_link_libraries(plot_persistence_heat_map ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( compute_distance_of_persistence_heat_maps compute_distance_of_persistence_heat_maps.cpp )
+target_link_libraries(compute_distance_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( compute_scalar_product_of_persistence_heat_maps compute_scalar_product_of_persistence_heat_maps.cpp )
+target_link_libraries(compute_scalar_product_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( create_pssk create_pssk.cpp )
+target_link_libraries(create_pssk ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( create_persistence_heat_maps_weighted_by_distance_from_diagonal create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp )
+target_link_libraries(create_persistence_heat_maps_weighted_by_distance_from_diagonal ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp )
+target_link_libraries(create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( create_persistence_heat_maps_weighted_by_arctan_of_their_persistence create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp )
+target_link_libraries(create_persistence_heat_maps_weighted_by_arctan_of_their_persistence ${Boost_SYSTEM_LIBRARY})
+
diff --git a/src/Gudhi_stat/utilities/persistence_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..901f1a03
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/average_persistence_heat_maps.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/persistence_representations/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< Persistence_heat_maps<constant_scaling_function>* > maps;
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ Persistence_heat_maps<constant_scaling_function>* l = new Persistence_heat_maps<constant_scaling_function>;
+ l->load_from_file( filenames[i] );
+ maps.push_back( l );
+ }
+
+ Persistence_heat_maps<constant_scaling_function> 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..e4f5fca6
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp
@@ -0,0 +1,111 @@
+/* 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/persistence_representations/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 heat maps 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 heat maps. For L^infty distance choose p = -1. \n";
+ std::cout << "The remaining parameters of this programs are names of files with persistence heat maps.\n";
+
+ if ( argc < 3 )
+ {
+ std::cout << "Wrong number of parameters, the program will now terminate \n";
+ return 1;
+ }
+
+ int pp = atoi( argv[1] );
+ double p = std::numeric_limits<double>::max();
+ if ( pp != -1 )
+ {
+ p = pp;
+ }
+
+
+ std::vector< const char* > filenames;
+ for ( int i = 2 ; i < argc ; ++i )
+ {
+ filenames.push_back( argv[i] );
+ }
+ std::vector< Persistence_heat_maps<constant_scaling_function> > maps;
+ maps.reserve( filenames.size() );
+ for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no )
+ {
+ Persistence_heat_maps<constant_scaling_function> l;
+ 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 > > 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] = maps[i].distance( maps[j] , p ) ;
+ }
+ }
+
+ //and now output the result to the screen and a file:
+ std::ofstream out;
+ out.open( "distance" );
+ for ( size_t i = 0 ; i != distance.size() ; ++i )
+ {
+ for ( size_t j = 0 ; j != distance.size() ; ++j )
+ {
+ std::cout << distance[i][j] << " ";
+ out << distance[i][j] << " ";
+ }
+ std::cout << std::endl;
+ out << std::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..cdeba692
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp
@@ -0,0 +1,89 @@
+/* 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/persistence_representations/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<constant_scaling_function> > maps;
+ maps.reserve( filenames.size() );
+ for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no )
+ {
+ Persistence_heat_maps<constant_scaling_function> l;
+ 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] = maps[i].compute_scalar_product( maps[j] ) ;
+ }
+ }
+
+ //and now output the result to the screen and a file:
+ std::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 )
+ {
+ std::cout << scalar_product[i][j] << " ";
+ out << scalar_product[i][j] << " ";
+ }
+ std::cout << std::endl;
+ out << std::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..5d2100aa
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp
@@ -0,0 +1,78 @@
+/* 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/persistence_representations/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<constant_scaling_function> l( filenames[i] , filter, 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..8496e33e
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp
@@ -0,0 +1,78 @@
+/* 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/persistence_representations/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<arc_tan_of_persistence_of_point> l( filenames[i] , filter, 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..83d4f3bc
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.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/persistence_representations/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<distance_from_diagonal_scaling> l( filenames[i] , filter , 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..f62615f5
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.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/persistence_representations/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<squared_distance_from_diagonal_scaling> l( filenames[i] , filter, 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..d38bb8b9
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/create_pssk.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/persistence_representations/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..59b14fe8
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp
@@ -0,0 +1,42 @@
+/* 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/persistence_representations/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<constant_scaling_function> l;
+ l.load_from_file( argv[1] );
+ l.plot( argv[1] );
+ return 0;
+}
diff --git a/src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt b/src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt
new file mode 100644
index 00000000..96cb1a5e
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt
@@ -0,0 +1,22 @@
+cmake_minimum_required(VERSION 2.6)
+project(GUDHI_STAT)
+
+
+
+#persitence diagrams
+add_executable ( plot_persistence_intervals plot_persistence_intervals.cpp )
+target_link_libraries( plot_persistence_intervals ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( compute_birth_death_range_in_persistence_diagram compute_birth_death_range_in_persistence_diagram.cpp )
+target_link_libraries( compute_birth_death_range_in_persistence_diagram ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( compute_number_of_dominant_intervals compute_number_of_dominant_intervals.cpp )
+target_link_libraries( compute_number_of_dominant_intervals ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( plot_histogram_of_intervals_lengths plot_histogram_of_intervals_lengths.cpp )
+target_link_libraries( plot_histogram_of_intervals_lengths ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( plot_persistence_Betti_numebrs plot_persistence_Betti_numebrs.cpp )
+target_link_libraries( plot_persistence_Betti_numebrs ${Boost_SYSTEM_LIBRARY})
+
+#when we have bottleneck and wasserstein distance computations, add suitable programs here.
diff --git a/src/Gudhi_stat/utilities/persistence_intervals/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..145040fe
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.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/persistence_representations/Persistence_intervals.h>
+
+#include <iostream>
+#include <vector>
+#include <limits>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+
+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 )
+ //{
+ // std::cout << "To run this program, please provide the name of a file with persistence diagram \n";
+ // return 1;
+ //}
+ //Persistence_intervals p( argv[1] );
+ //std::pair<double,double> min_max_ = p.min_max();
+ //std::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;
+ }
+ std::cout << "Birth-death range : min: " << min_ << ", max: " << max_ << std::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..eeda703a
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp
@@ -0,0 +1,54 @@
+/* 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/persistence_representations/Persistence_intervals.h>
+
+#include <iostream>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+
+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 )
+ {
+ std::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::cout << "Here are the dominant intervals : " << std::endl;
+ for ( size_t i = 0 ; i != dominant_intervals.size() ; ++i )
+ {
+ std::cout << " " << dominant_intervals[i].first<< "," << dominant_intervals[i].second << " "<< std::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..db9c3f98
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp
@@ -0,0 +1,66 @@
+/* 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/persistence_representations/Persistence_intervals.h>
+
+#include <iostream>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+
+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 )
+ {
+ std::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.histogram_of_lengths( 10 );
+
+ std::stringstream gnuplot_script;
+ gnuplot_script << argv[1] << "_Gnuplot_script";
+ std::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 << std::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..cb89f6b9
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp
@@ -0,0 +1,90 @@
+/* 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/persistence_representations/Persistence_intervals.h>
+
+#include <iostream>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+
+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 )
+ {
+ std::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";
+ std::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 << "]" << std::endl;
+ out << "set yrange [" << yRangeBegin << " : " << yRangeEnd << "]" << std::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 << std::endl;
+ out << pbns[i].first << " " << pbns[i].second << std::endl;
+ previous_y = pbns[i].second;
+ }
+ out << std::endl;
+ out.close();
+
+ //for ( size_t i = 0 ; i != pbns.size() ; ++i )
+ //{
+ // std::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..04a05caa
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_intervals.cpp
@@ -0,0 +1,58 @@
+/* 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/persistence_representations/Persistence_intervals.h>
+#include <gudhi/read_persitence_from_file.h>
+
+#include <iostream>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+
+double epsilon = 0.0000005;
+
+
+int main( int argc , char** argv )
+{
+ if ( argc != 2 )
+ {
+ std::cout << "To run this program, please provide the name of a file with persistence diagram \n";
+ return 1;
+ }
+ std::vector< std::pair< double , double > > intervals = read_gudhi_file( argv[1] , 2 );
+ Persistence_intervals b( intervals );
+ b.plot( argv[1] );
+ return 0;
+}
+
+
+
+
+
+
+
diff --git a/src/Gudhi_stat/utilities/persistence_landscapes/CMakeLists.txt b/src/Gudhi_stat/utilities/persistence_landscapes/CMakeLists.txt
new file mode 100644
index 00000000..9caf73f6
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_landscapes/CMakeLists.txt
@@ -0,0 +1,21 @@
+cmake_minimum_required(VERSION 2.6)
+project(GUDHI_STAT)
+
+
+
+#persitence landscapes
+add_executable ( average_landscapes average_landscapes.cpp )
+target_link_libraries(average_landscapes ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( create_landscapes create_landscapes.cpp )
+target_link_libraries(create_landscapes ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( plot_landscapes plot_landscapes.cpp )
+target_link_libraries(plot_landscapes ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( compute_distance_of_landscapes compute_distance_of_landscapes.cpp )
+target_link_libraries(compute_distance_of_landscapes ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( compute_scalar_product_of_landscapes compute_scalar_product_of_landscapes.cpp )
+target_link_libraries(compute_scalar_product_of_landscapes ${Boost_SYSTEM_LIBRARY})
+
diff --git a/src/Gudhi_stat/utilities/persistence_landscapes/average_landscapes.cpp b/src/Gudhi_stat/utilities/persistence_landscapes/average_landscapes.cpp
new file mode 100644
index 00000000..2a50acd8
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_landscapes/average_landscapes.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/persistence_representations/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< Persistence_landscape* > 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( 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..0b16ac26
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp
@@ -0,0 +1,112 @@
+/* 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/persistence_representations/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 pp = atoi( argv[1] );
+ double p = std::numeric_limits<double>::max();
+ if ( pp != -1 )
+ {
+ p = pp;
+ }
+
+
+ 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_distance_of_landscapes( landscaspes[i], landscaspes[j] , p ) ;
+
+ }
+ }
+
+ //and now output the result to the screen and a file:
+ std::ofstream out;
+ out.open( "distance" );
+ for ( size_t i = 0 ; i != distance.size() ; ++i )
+ {
+ for ( size_t j = 0 ; j != distance.size() ; ++j )
+ {
+ std::cout << distance[i][j] << " ";
+ out << distance[i][j] << " ";
+ }
+ std::cout << std::endl;
+ out << std::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..16a15174
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp
@@ -0,0 +1,89 @@
+/* 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/persistence_representations/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:
+ std::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 )
+ {
+ std::cout << scalar_product[i][j] << " ";
+ out << scalar_product[i][j] << " ";
+ }
+ std::cout << std::endl;
+ out << std::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..5485bf2a
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_landscapes/create_landscapes.cpp
@@ -0,0 +1,53 @@
+/* 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/persistence_representations/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 )
+ {
+ //std::vector< std::pair< double , double > > pers = read_standard_file( filename );
+ 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..aad8e147
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_landscapes/plot_landscapes.cpp
@@ -0,0 +1,47 @@
+/* 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/persistence_representations/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/CMakeLists.txt b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/CMakeLists.txt
new file mode 100644
index 00000000..bb7c3987
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/CMakeLists.txt
@@ -0,0 +1,22 @@
+cmake_minimum_required(VERSION 2.6)
+project(GUDHI_STAT)
+
+
+
+
+#persitence landscapes on a grid
+add_executable ( average_landscapes_on_grid average_landscapes_on_grid.cpp )
+target_link_libraries(average_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( create_landscapes_on_grid create_landscapes_on_grid.cpp )
+target_link_libraries(create_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( plot_landscapes_on_grid plot_landscapes_on_grid.cpp )
+target_link_libraries(plot_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( compute_distance_of_landscapes_on_grid compute_distance_of_landscapes_on_grid.cpp )
+target_link_libraries(compute_distance_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( compute_scalar_product_of_landscapes_on_grid compute_scalar_product_of_landscapes_on_grid.cpp )
+target_link_libraries(compute_scalar_product_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
+
diff --git a/src/Gudhi_stat/utilities/persistence_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..d3851734
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp
@@ -0,0 +1,71 @@
+/* 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/persistence_representations/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< Persistence_landscape_on_grid* > 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( 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..29c37159
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp
@@ -0,0 +1,110 @@
+/* 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/persistence_representations/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 pp = atoi( argv[1] );
+ double p = std::numeric_limits<double>::max();
+ if ( pp != -1 )
+ {
+ p = pp;
+ }
+
+
+ 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_distance_of_landscapes_on_grid( landscaspes[i], landscaspes[j] , p ) ;
+ }
+ }
+
+ //and now output the result to the screen and a file:
+ std::ofstream out;
+ out.open( "distance" );
+ for ( size_t i = 0 ; i != distance.size() ; ++i )
+ {
+ for ( size_t j = 0 ; j != distance.size() ; ++j )
+ {
+ std::cout << distance[i][j] << " ";
+ out << distance[i][j] << " ";
+ }
+ std::cout << std::endl;
+ out << std::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..326e5587
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp
@@ -0,0 +1,89 @@
+/* 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/persistence_representations/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:
+ std::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 )
+ {
+ std::cout << scalar_product[i][j] << " ";
+ out << scalar_product[i][j] << " ";
+ }
+ std::cout << std::endl;
+ out << std::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..4f36f02d
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.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/persistence_representations/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..b5687ea2
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp
@@ -0,0 +1,52 @@
+/* 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/persistence_representations/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/CMakeLists.txt b/src/Gudhi_stat/utilities/persistence_vectors/CMakeLists.txt
new file mode 100644
index 00000000..ebf4898e
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_vectors/CMakeLists.txt
@@ -0,0 +1,20 @@
+cmake_minimum_required(VERSION 2.6)
+project(GUDHI_STAT)
+
+#persitence vectors
+add_executable ( average_persistence_vectors average_persistence_vectors.cpp )
+target_link_libraries(average_persistence_vectors ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( create_persistence_vectors create_persistence_vectors.cpp )
+target_link_libraries(create_persistence_vectors ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( compute_distance_of_persistence_vectors compute_distance_of_persistence_vectors.cpp )
+target_link_libraries(compute_distance_of_persistence_vectors ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( compute_scalar_product_of_persistence_vectors compute_scalar_product_of_persistence_vectors.cpp )
+target_link_libraries(compute_scalar_product_of_persistence_vectors ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( plot_persistence_vectors plot_persistence_vectors.cpp )
+target_link_libraries(plot_persistence_vectors ${Boost_SYSTEM_LIBRARY})
+
+
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..822d0e2a
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_vectors/average_persistence_vectors.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/persistence_representations/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< Vector_distances_in_diagram< Euclidean_distance<double> >* > 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(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..6d242cd1
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp
@@ -0,0 +1,111 @@
+/* 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/persistence_representations/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 pp = atoi( argv[1] );
+ double p = std::numeric_limits<double>::max();
+ if ( pp != -1 )
+ {
+ p = pp;
+ }
+
+
+ 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;
+ 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] = vectors[i].distance( vectors[j] , p ) ;
+ }
+ }
+
+ //and now output the result to the screen and a file:
+ std::ofstream out;
+ out.open( "distance" );
+ for ( size_t i = 0 ; i != distance.size() ; ++i )
+ {
+ for ( size_t j = 0 ; j != distance.size() ; ++j )
+ {
+ std::cout << distance[i][j] << " ";
+ out << distance[i][j] << " ";
+ }
+ std::cout << std::endl;
+ out << std::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..e4c62194
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp
@@ -0,0 +1,87 @@
+/* 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/persistence_representations/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;
+ 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] = vectors[i].compute_scalar_product( vectors[j] ) ;
+ }
+ }
+
+ //and now output the result to the screen and a file:
+ std::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 )
+ {
+ std::cout << scalar_product[i][j] << " ";
+ out << scalar_product[i][j] << " ";
+ }
+ std::cout << std::endl;
+ out << std::endl;
+ }
+ out.close();
+ 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..926e46fd
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_vectors/create_persistence_vectors.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/persistence_representations/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;
+ //std::vector< std::pair< double , double > > persistence_pairs = read_gudhi_file( filenames[i] , size_t dimension = 0 )
+ 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..0ef30be8
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_vectors/plot_persistence_vectors.cpp
@@ -0,0 +1,48 @@
+/* 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/persistence_representations/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;
+}
+
diff --git a/src/Gudhi_stat/utilities/sliding_window_embedding.cpp b/src/Gudhi_stat/utilities/sliding_window_embedding.cpp
new file mode 100644
index 00000000..1373b52c
--- /dev/null
+++ b/src/Gudhi_stat/utilities/sliding_window_embedding.cpp
@@ -0,0 +1,40 @@
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <string>
+#include <sstream>
+#include <cstdlib>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <string>
+
+#include <gudhi/time_series_analysis/sliding_window.h>
+
+using namespace Gudhi;
+using namespace Gudhi_stat;
+
+
+int main( int argc , char** argv )
+{
+ //this array contains value of sin(x_n) for x_0 = 0 and x_{n+1} = _{n} + 0.1 for n \in {0,115-23}.
+ static const double arr[] = {0, 0.0998334166, 0.1986693308, 0.2955202067, 0.3894183423, 0.4794255386, 0.5646424734, 0.6442176872, 0.7173560909, 0.7833269096, 0.8414709848, 0.8912073601, 0.932039086, 0.9635581854, 0.98544973,
+ 0.9974949866, 0.999573603, 0.9916648105, 0.9738476309, 0.9463000877, 0.9092974268, 0.8632093666, 0.8084964038, 0.7457052122, 0.6754631806, 0.5984721441, 0.5155013718, 0.4273798802, 0.3349881502,
+ 0.2392493292, 0.1411200081, 0.0415806624, -0.0583741434, -0.1577456941, -0.255541102, -0.3507832277, -0.4425204433, -0.5298361409, -0.6118578909, -0.6877661592, -0.7568024953, -0.8182771111, -0.8715757724,
+ -0.9161659367, -0.9516020739, -0.9775301177, -0.9936910036, -0.9999232576, -0.9961646088, -0.9824526126, -0.9589242747, -0.9258146823, -0.8834546557, -0.8322674422, -0.7727644876, -0.7055403256,
+ -0.6312666379, -0.5506855426, -0.4646021794, -0.3738766648, -0.2794154982, -0.1821625043, -0.0830894028, 0.0168139005, 0.1165492049, 0.2151199881, 0.3115413635, 0.4048499206, 0.4941133511, 0.5784397644,
+ 0.6569865987, 0.7289690401, 0.7936678638, 0.8504366206, 0.8987080958, 0.9379999768, 0.967919672, 0.9881682339, 0.9985433454, 0.9989413418, 0.9893582466, 0.9698898108, 0.9407305567, 0.9021718338, 0.8545989081,
+ 0.7984871126, 0.7343970979, 0.6629692301, 0.5849171929, 0.5010208565, 0.4121184852, 0.3190983623, 0.2228899141, 0.1244544235, 0.0247754255, -0.0751511205, -0.1743267812, -0.2717606264, -0.3664791293,
+ -0.4575358938, -0.5440211109, -0.6250706489, -0.6998746876, -0.7676858098, -0.8278264691, -0.87969576, -0.9227754216, -0.9566350163, -0.9809362301, -0.9954362533, -0.9999902066, -0.9945525882, -0.9791777292,
+ -0.9540192499, -0.9193285257, -0.8754521747};
+ vector< double > time_series (arr, arr + sizeof(arr) / sizeof(arr[0]) );
+
+ //construct sliding window embeddign to dimension 3 based on time_series:
+ Sliding_window_embedding swe( time_series , 3 );
+ swe.create_point_cloud("pt_cloud");
+
+ //persistent_cohomology::Persistent_cohomology<ST, Field_Zp >& a =
+ swe.compute_persistence_of_Vietoris_Rips_complex( 1 , 2 );
+
+
+ return 0;
+}