summaryrefslogtreecommitdiff
path: root/src/Gudhi_stat
diff options
context:
space:
mode:
authorpdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-09-23 13:18:09 +0000
committerpdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-09-23 13:18:09 +0000
commit5719bcccd6b09eadcae8de8d9b8f1aa4983c56b3 (patch)
tree6547a06b76892416dcd7f1bf86f8605acd26e955 /src/Gudhi_stat
parent1df5ef4350bd17588bf431eb809fff6818bff93e (diff)
Finished adding utitilites. Note that they are still not tested!!!
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/gudhi_stat@1553 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 61243549302b6e87376c7c725240949be67d44ac
Diffstat (limited to 'src/Gudhi_stat')
-rw-r--r--src/Gudhi_stat/example/CMakeLists.txt49
-rw-r--r--src/Gudhi_stat/example/persistence_heat_maps.cpp8
-rw-r--r--src/Gudhi_stat/example/persistence_landscape.cpp2
-rw-r--r--src/Gudhi_stat/example/persistence_landscape_on_grid.cpp2
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp73
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp107
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp91
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp76
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp50
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_landscapes/average_landscapes.cpp2
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_landscapes/create_landscapes.cpp2
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_landscapes/plot_landscapes.cpp2
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp74
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp107
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp91
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp79
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp50
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_vectors/average_persistence_vectors.cpp74
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp107
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp97
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_vectors/create_persistence_vectors.cpp56
-rw-r--r--src/Gudhi_stat/example/vector_representation.cpp1
-rw-r--r--src/Gudhi_stat/include/gudhi/concretizations/Persistence_heat_maps.h56
-rw-r--r--src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h38
-rw-r--r--src/Gudhi_stat/test/persistence_heat_maps_test.cpp2
-rw-r--r--src/Gudhi_stat/test/persistence_lanscapes_on_grid_test.cpp2
-rw-r--r--src/Gudhi_stat/test/persistence_lanscapes_test.cpp2
27 files changed, 1272 insertions, 28 deletions
diff --git a/src/Gudhi_stat/example/CMakeLists.txt b/src/Gudhi_stat/example/CMakeLists.txt
index a0390875..0dd35dd6 100644
--- a/src/Gudhi_stat/example/CMakeLists.txt
+++ b/src/Gudhi_stat/example/CMakeLists.txt
@@ -48,8 +48,55 @@ target_link_libraries(utilities/persistence_landscapes/create_landscapes ${Boost
add_executable ( utilities/persistence_landscapes/plot_landscapes utilities/persistence_landscapes/plot_landscapes.cpp )
target_link_libraries(utilities/persistence_landscapes/plot_landscapes ${Boost_SYSTEM_LIBRARY})
+add_executable ( utilities/persistence_landscapes/compute_distance_of_landscapes utilities/persistence_landscapes/compute_distance_of_landscapes.cpp )
+target_link_libraries(utilities/persistence_landscapes/compute_distance_of_landscapes ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( utilities/persistence_landscapes/compute_scalar_product_of_landscapes utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp )
+target_link_libraries(utilities/persistence_landscapes/compute_scalar_product_of_landscapes ${Boost_SYSTEM_LIBRARY})
+
#persitence landscapes on a grid
+add_executable ( utilities/persistence_landscapes_on_grid/average_landscapes_on_grid utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp )
+target_link_libraries(utilities/persistence_landscapes_on_grid/average_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( utilities/persistence_landscapes_on_grid/create_landscapes_on_grid utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp )
+target_link_libraries(utilities/persistence_landscapes_on_grid/create_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp )
+target_link_libraries(utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp )
+target_link_libraries(utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp )
+target_link_libraries(utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
+
+#persitence heat maps
+add_executable ( utilities/persistence_heat_maps/average_persistence_heat_maps utilities/persistence_heat_maps/average_persistence_heat_maps.cpp )
+target_link_libraries(utilities/persistence_heat_maps/average_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( utilities/persistence_heat_maps/create_persistence_heat_maps utilities/persistence_heat_maps/create_persistence_heat_maps.cpp )
+target_link_libraries(utilities/persistence_heat_maps/create_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
-#persitence images
+add_executable ( utilities/persistence_heat_maps/plot_persistence_heat_map utilities/persistence_heat_maps/plot_persistence_heat_map.cpp )
+target_link_libraries(utilities/persistence_heat_maps/plot_persistence_heat_map ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp )
+target_link_libraries(utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp )
+target_link_libraries(utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
#persitence vectors
+add_executable ( utilities/persistence_vectors/average_persistence_vectors utilities/persistence_vectors/average_persistence_vectors.cpp )
+target_link_libraries(utilities/persistence_vectors/average_persistence_vectors ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( utilities/persistence_vectors/create_persistence_vectors utilities/persistence_vectors/create_persistence_vectors.cpp )
+target_link_libraries(utilities/persistence_vectors/create_persistence_vectors ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( utilities/persistence_vectors/compute_distance_of_persistence_vectors utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp )
+target_link_libraries(utilities/persistence_vectors/compute_distance_of_persistence_vectors ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp )
+target_link_libraries(utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors ${Boost_SYSTEM_LIBRARY})
+
+
diff --git a/src/Gudhi_stat/example/persistence_heat_maps.cpp b/src/Gudhi_stat/example/persistence_heat_maps.cpp
index fc9e31a0..cd0c4113 100644
--- a/src/Gudhi_stat/example/persistence_heat_maps.cpp
+++ b/src/Gudhi_stat/example/persistence_heat_maps.cpp
@@ -83,7 +83,7 @@ int main( int argc , char** argv )
//test to construct persistence heat map:
std::vector< std::vector<double> > filter = create_Gaussian_filter(100,1);
Persistence_heat_maps p( "file_with_diagram" , filter , constant_function, false , 1000 , 0 , 1 );
- p.write_to_file( "persistence_heat_map_from_file_with_diagram" );
+ p.print_to_file( "persistence_heat_map_from_file_with_diagram" );
Persistence_heat_maps q;
q.load_from_file( "persistence_heat_map_from_file_with_diagram" );
@@ -126,7 +126,7 @@ int main( int argc , char** argv )
Persistence_heat_maps av;
av.compute_average( to_average );
- av.write_to_file( "template_average_of_heat_maps" );
+ av.print_to_file( "template_average_of_heat_maps" );
*/
/*
@@ -162,7 +162,7 @@ int main( int argc , char** argv )
Persistence_heat_maps median;
median.compute_median( to_compute_median );
- median.write_to_file( "template_median_of_heat_maps" );
+ median.print_to_file( "template_median_of_heat_maps" );
*/
@@ -179,7 +179,7 @@ int main( int argc , char** argv )
Persistence_heat_maps percentage_of_active;
percentage_of_active.compute_percentage_of_active( to_compute_percentage_of_active , 0.1 );
- percentage_of_active.write_to_file( "template_percentage_of_active_of_heat_maps" );
+ percentage_of_active.print_to_file( "template_percentage_of_active_of_heat_maps" );
//percentage_of_active.plot( "template_percentage_of_active_of_heat_maps" );
diff --git a/src/Gudhi_stat/example/persistence_landscape.cpp b/src/Gudhi_stat/example/persistence_landscape.cpp
index 7bd04b4d..ab58886a 100644
--- a/src/Gudhi_stat/example/persistence_landscape.cpp
+++ b/src/Gudhi_stat/example/persistence_landscape.cpp
@@ -23,7 +23,7 @@
#include <gudhi/abstract_classes/Abs_Topological_data.h>
-#include <gudhi/concretizations/Persistence_landscapes.h>
+#include <gudhi/concretizations/Persistence_landscape.h>
diff --git a/src/Gudhi_stat/example/persistence_landscape_on_grid.cpp b/src/Gudhi_stat/example/persistence_landscape_on_grid.cpp
index d5b0808b..7781493b 100644
--- a/src/Gudhi_stat/example/persistence_landscape_on_grid.cpp
+++ b/src/Gudhi_stat/example/persistence_landscape_on_grid.cpp
@@ -23,7 +23,7 @@
#include <gudhi/abstract_classes/Abs_Topological_data.h>
-#include <gudhi/concretizations/Persistence_landscapes_on_grid.h>
+#include <gudhi/concretizations/Persistence_landscape_on_grid.h>
diff --git a/src/Gudhi_stat/example/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp b/src/Gudhi_stat/example/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp
new file mode 100644
index 00000000..a7359a02
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp
@@ -0,0 +1,73 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA Sophia-Saclay (France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_heat_maps.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program computes average persistence landscape of persistence landscapes created based on persistence diagrams provided as an input. Please call this program with the names of files with persistence diagrams \n";
+ std::vector< const char* > filenames;
+
+ if ( argc == 1 )
+ {
+ std::cout << "No input files given, the program will now terminate \n";
+ return 1;
+ }
+
+ for ( int i = 1 ; i < argc ; ++i )
+ {
+ filenames.push_back( argv[i] );
+ }
+
+ std::cout << "Creating persistence landscapes...\n";
+ std::vector< Abs_Topological_data_with_averages* > maps;
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ Persistence_heat_maps* l = new Persistence_heat_maps;
+ l->load_from_file( filenames[i] );
+ maps.push_back( (Abs_Topological_data_with_averages*)l );
+ }
+
+ Persistence_heat_maps av;
+ av.compute_average( maps );
+
+ av.print_to_file( "average" );
+
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ delete maps[i];
+ }
+
+ std::cout << "Done \n";
+ return 0;
+}
diff --git a/src/Gudhi_stat/example/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp b/src/Gudhi_stat/example/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp
new file mode 100644
index 00000000..8164a93e
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp
@@ -0,0 +1,107 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA Sophia-Saclay (France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_heat_maps.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program compute dsitance of persistence landscapes stored in a file (the file needs to be created beforehand). \n";
+ std::cout << "The first parameter of a program is an interger p. The program compute L^p distance of the two landscapes. For L^infty distance choose p = -1. \n";
+ std::cout << "The remaining parameters of this programs are names of files with persistence landscapes.";
+
+ if ( argc < 3 )
+ {
+ std::cout << "Wrong number of parameters, the program will now terminate \n";
+ return 1;
+ }
+
+ int p = atoi( argv[3] );
+
+ std::vector< const char* > filenames;
+ for ( int i = 2 ; i < argc ; ++i )
+ {
+ filenames.push_back( argv[i] );
+ }
+ std::vector< Abs_Topological_data_with_distances* > maps;
+ maps.reserve( filenames.size() );
+ for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no )
+ {
+ Persistence_heat_maps* l = new Persistence_heat_maps;
+ l->load_from_file( filenames[file_no] );
+ maps.push_back( (Abs_Topological_data_with_distances*)l );
+ }
+
+ //and now we will compute the scalar product of landscapes.
+
+ //first we prepare an array:
+ std::vector< std::vector< double > > distance( filenames.size() );
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ std::vector< double > v( filenames.size() , 0 );
+ distance[i] = v;
+ }
+
+ //and now we can compute the distnaces:
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ for ( size_t j = i ; j != filenames.size() ; ++j )
+ {
+ distance[i][j] = distance[j][i] = ((Persistence_heat_maps*)maps[i])->distance( maps[j] , p ) ;
+ }
+ }
+
+ //and now output the result to the screen and a file:
+ ofstream out;
+ out.open( "distance" );
+ for ( size_t i = 0 ; i != distance.size() ; ++i )
+ {
+ for ( size_t j = 0 ; j != distance.size() ; ++j )
+ {
+ cout << distance[i][j] << " ";
+ out << distance[i][j] << " ";
+ }
+ cout << endl;
+ out << endl;
+ }
+ out.close();
+
+ return 0;
+}
+
+
+
+
+
+
+
diff --git a/src/Gudhi_stat/example/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp b/src/Gudhi_stat/example/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp
new file mode 100644
index 00000000..82fe207e
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp
@@ -0,0 +1,91 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA Sophia-Saclay (France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_heat_maps.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program compute scalar product of persistence landscapes stored in a file (the file needs to be created beforehand). \n";
+ std::cout << "The parameters of this programs are names of files with persistence landscapes.";
+
+ std::vector< const char* > filenames;
+ for ( int i = 1 ; i < argc ; ++i )
+ {
+ filenames.push_back( argv[i] );
+ }
+ std::vector< Persistence_heat_maps* > maps;
+ maps.reserve( filenames.size() );
+ for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no )
+ {
+ Persistence_heat_maps* l = new Persistence_heat_maps;
+ l->load_from_file( filenames[file_no] );
+ maps.push_back( l );
+ }
+
+ //and now we will compute the scalar product of landscapes.
+
+ //first we prepare an array:
+ std::vector< std::vector< double > > scalar_product( filenames.size() );
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ std::vector< double > v( filenames.size() , 0 );
+ scalar_product[i] = v;
+ }
+
+ //and now we can compute the scalar product:
+ for ( size_t i = 0 ; i != maps.size() ; ++i )
+ {
+ for ( size_t j = i ; j != maps.size() ; ++j )
+ {
+ scalar_product[i][j] = scalar_product[j][i] = ((Persistence_heat_maps*)maps[i])->compute_scalar_product( maps[j] ) ;
+ }
+ }
+
+ //and now output the result to the screen and a file:
+ ofstream out;
+ out.open( "scalar_product" );
+ for ( size_t i = 0 ; i != scalar_product.size() ; ++i )
+ {
+ for ( size_t j = 0 ; j != scalar_product.size() ; ++j )
+ {
+ cout << scalar_product[i][j] << " ";
+ out << scalar_product[i][j] << " ";
+ }
+ cout << endl;
+ out << endl;
+ }
+ out.close();
+
+ return 0;
+}
diff --git a/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp b/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp
new file mode 100644
index 00000000..152a1616
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp
@@ -0,0 +1,76 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA Sophia-Saclay (France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_heat_maps.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program creates persistence 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 remoaning 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 heat maps...\n";
+ std::vector< std::vector<double> > filter = create_Gaussian_filter(10,1);
+
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ Persistence_heat_maps l( filenames[i] , filter, constant_function, false , size_of_grid , min_ , max_ );
+ std::stringstream ss;
+ ss << filenames[i] << ".land";
+ l.print_to_file( ss.str().c_str() );
+ }
+ std::cout << "Done \n";
+ return 0;
+}
diff --git a/src/Gudhi_stat/example/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp b/src/Gudhi_stat/example/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp
new file mode 100644
index 00000000..d163aba6
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_heat_maps/plot_persistence_heat_map.cpp
@@ -0,0 +1,50 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA Sophia-Saclay (France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_heat_maps.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program plot persistence landscape stored in a file (the file needs to be created beforehand). Please call the code with the name of a landsape file \n";
+ Persistence_heat_maps l;
+ l.load_from_file( argv[1] );
+
+ std::stringstream ss;
+ ss << argv[1] << "_gnuplot_script";
+ l.plot( ss.str().c_str() );
+
+ std::cout << "Done \n";
+
+ return 0;
+}
diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes/average_landscapes.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes/average_landscapes.cpp
index ac3b6432..47c3f150 100644
--- a/src/Gudhi_stat/example/utilities/persistence_landscapes/average_landscapes.cpp
+++ b/src/Gudhi_stat/example/utilities/persistence_landscapes/average_landscapes.cpp
@@ -23,7 +23,7 @@
#include <gudhi/abstract_classes/Abs_Topological_data.h>
-#include <gudhi/concretizations/Persistence_landscapes.h>
+#include <gudhi/concretizations/Persistence_landscape.h>
diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes/create_landscapes.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes/create_landscapes.cpp
index 0a5df3b9..5152a033 100644
--- a/src/Gudhi_stat/example/utilities/persistence_landscapes/create_landscapes.cpp
+++ b/src/Gudhi_stat/example/utilities/persistence_landscapes/create_landscapes.cpp
@@ -23,7 +23,7 @@
#include <gudhi/abstract_classes/Abs_Topological_data.h>
-#include <gudhi/concretizations/Persistence_landscapes.h>
+#include <gudhi/concretizations/Persistence_landscape.h>
diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes/plot_landscapes.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes/plot_landscapes.cpp
index 55575b97..559fc096 100644
--- a/src/Gudhi_stat/example/utilities/persistence_landscapes/plot_landscapes.cpp
+++ b/src/Gudhi_stat/example/utilities/persistence_landscapes/plot_landscapes.cpp
@@ -23,7 +23,7 @@
#include <gudhi/abstract_classes/Abs_Topological_data.h>
-#include <gudhi/concretizations/Persistence_landscapes.h>
+#include <gudhi/concretizations/Persistence_landscape.h>
diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp
new file mode 100644
index 00000000..497e2c7c
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/average_landscapes_on_grid.cpp
@@ -0,0 +1,74 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA Sophia-Saclay (France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_landscape_on_grid.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program computes average persistence landscape on grid of persistence landscapes on grid created based on persistence diagrams provided as an input. Please call this program with the names of files with persistence diagrams \n";
+ std::vector< const char* > filenames;
+
+ if ( argc == 1 )
+ {
+ std::cout << "No input files given, the program will now terminate \n";
+ return 1;
+ }
+
+ for ( int i = 1 ; i < argc ; ++i )
+ {
+ filenames.push_back( argv[i] );
+ }
+
+ std::cout << "Creating persistence landscapes...\n";
+ std::vector< Abs_Topological_data_with_averages* > lands;
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ Persistence_landscape_on_grid* l = new Persistence_landscape_on_grid;
+ l->load_landscape_from_file( filenames[i] );
+ lands.push_back( (Abs_Topological_data_with_averages*)l );
+ }
+
+ Persistence_landscape_on_grid av;
+ av.compute_average( lands );
+
+ av.print_to_file( "average" );
+
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ delete lands[i];
+ }
+
+ std::cout << "Done \n";
+
+ return 0;
+}
diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp
new file mode 100644
index 00000000..355b7976
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp
@@ -0,0 +1,107 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA Sophia-Saclay (France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_landscape_on_grid.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program compute dsitance of persistence landscapes on grid stored in a file (the file needs to be created beforehand). \n";
+ std::cout << "The first parameter of a program is an interger p. The program compute L^p distance of the two 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.";
+
+ if ( argc < 3 )
+ {
+ std::cout << "Wrong number of parameters, the program will now terminate \n";
+ return 1;
+ }
+
+ int p = atoi( argv[3] );
+
+ std::vector< const char* > filenames;
+ for ( int i = 2 ; i < argc ; ++i )
+ {
+ filenames.push_back( argv[i] );
+ }
+ std::vector< Persistence_landscape_on_grid > landscaspes;
+ landscaspes.reserve( filenames.size() );
+ for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no )
+ {
+ Persistence_landscape_on_grid l;
+ l.load_landscape_from_file( filenames[file_no] );
+ landscaspes.push_back( l );
+ }
+
+ //and now we will compute the scalar product of landscapes.
+
+ //first we prepare an array:
+ std::vector< std::vector< double > > distance( filenames.size() );
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ std::vector< double > v( filenames.size() , 0 );
+ distance[i] = v;
+ }
+
+ //and now we can compute the scalar product:
+ for ( size_t i = 0 ; i != landscaspes.size() ; ++i )
+ {
+ for ( size_t j = i ; j != landscaspes.size() ; ++j )
+ {
+ distance[i][j] = distance[j][i] = compute_discance_of_landscapes_on_grid( landscaspes[i], landscaspes[j] , p ) ;
+ }
+ }
+
+ //and now output the result to the screen and a file:
+ ofstream out;
+ out.open( "distance" );
+ for ( size_t i = 0 ; i != distance.size() ; ++i )
+ {
+ for ( size_t j = 0 ; j != distance.size() ; ++j )
+ {
+ cout << distance[i][j] << " ";
+ out << distance[i][j] << " ";
+ }
+ cout << endl;
+ out << endl;
+ }
+ out.close();
+
+ return 0;
+}
+
+
+
+
+
+
+
diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp
new file mode 100644
index 00000000..4f6f2f5a
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp
@@ -0,0 +1,91 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA Sophia-Saclay (France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_landscape_on_grid.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program compute scalar product of persistence landscapes on grid stored in a file (the file needs to be created beforehand). \n";
+ std::cout << "The parameters of this programs are names of files with persistence landscapes on grid.";
+
+ std::vector< const char* > filenames;
+ for ( int i = 1 ; i < argc ; ++i )
+ {
+ filenames.push_back( argv[i] );
+ }
+ std::vector< Persistence_landscape_on_grid > landscaspes;
+ landscaspes.reserve( filenames.size() );
+ for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no )
+ {
+ Persistence_landscape_on_grid l;
+ l.load_landscape_from_file( filenames[file_no] );
+ landscaspes.push_back( l );
+ }
+
+ //and now we will compute the scalar product of landscapes.
+
+ //first we prepare an array:
+ std::vector< std::vector< double > > scalar_product( filenames.size() );
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ std::vector< double > v( filenames.size() , 0 );
+ scalar_product[i] = v;
+ }
+
+ //and now we can compute the scalar product:
+ for ( size_t i = 0 ; i != landscaspes.size() ; ++i )
+ {
+ for ( size_t j = i ; j != landscaspes.size() ; ++j )
+ {
+ scalar_product[i][j] = scalar_product[j][i] = compute_inner_product( landscaspes[i], landscaspes[j] ) ;
+ }
+ }
+
+ //and now output the result to the screen and a file:
+ ofstream out;
+ out.open( "scalar_product" );
+ for ( size_t i = 0 ; i != scalar_product.size() ; ++i )
+ {
+ for ( size_t j = 0 ; j != scalar_product.size() ; ++j )
+ {
+ cout << scalar_product[i][j] << " ";
+ out << scalar_product[i][j] << " ";
+ }
+ cout << endl;
+ out << endl;
+ }
+ out.close();
+
+ return 0;
+}
diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp
new file mode 100644
index 00000000..096f1036
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp
@@ -0,0 +1,79 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA Sophia-Saclay (France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_landscape_on_grid.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program creates persistence landscape on grid of diagrams provided as an input.\n";
+ std::cout << "The first parameter of a program is an integer, a size of a grid.\n";
+ std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n";
+ std::cout << "The remoaning 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 )
+ {
+ 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] << ".land";
+ l.print_to_file( ss.str().c_str() );
+ }
+ std::cout << "Done \n";
+ return 0;
+}
diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp
new file mode 100644
index 00000000..21d2c014
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_landscapes_on_grid/plot_landscapes_on_grid.cpp
@@ -0,0 +1,50 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA Sophia-Saclay (France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_landscape_on_grid.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program plot persistence landscape on grid stored in a file (the file needs to be created beforehand). Please call the code with the name of a landsape on grid file \n";
+ Persistence_landscape_on_grid l;
+ l.load_landscape_from_file( argv[1] );
+
+ std::stringstream ss;
+ ss << argv[1] << "_gnuplot_script";
+ l.plot( ss.str().c_str() );
+
+ std::cout << "Done \n";
+
+ return 0;
+}
diff --git a/src/Gudhi_stat/example/utilities/persistence_vectors/average_persistence_vectors.cpp b/src/Gudhi_stat/example/utilities/persistence_vectors/average_persistence_vectors.cpp
new file mode 100644
index 00000000..f0c0ba61
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_vectors/average_persistence_vectors.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 Sophia-Saclay (France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Vector_distances_in_diagram.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program computes average persistence landscape of persistence landscapes created based on persistence diagrams provided as an input. Please call this program with the names of files with persistence diagrams \n";
+ std::vector< const char* > filenames;
+
+ if ( argc == 1 )
+ {
+ std::cout << "No input files given, the program will now terminate \n";
+ return 1;
+ }
+
+ for ( int i = 1 ; i < argc ; ++i )
+ {
+ filenames.push_back( argv[i] );
+ }
+
+ std::cout << "Creating persistence landscapes...\n";
+ std::vector< Abs_Topological_data_with_averages* > lands;
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ Vector_distances_in_diagram< euclidean_distance<double> >* l = new Vector_distances_in_diagram< euclidean_distance<double> >;
+ l->load_from_file( filenames[i] );
+ lands.push_back( (Abs_Topological_data_with_averages*)l );
+ }
+
+ Vector_distances_in_diagram< euclidean_distance<double> > av;
+ av.compute_average( lands );
+
+ av.print_to_file( "average" );
+
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ delete lands[i];
+ }
+
+ std::cout << "Done \n";
+
+ return 0;
+}
diff --git a/src/Gudhi_stat/example/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp b/src/Gudhi_stat/example/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp
new file mode 100644
index 00000000..f93c910a
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp
@@ -0,0 +1,107 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA Sophia-Saclay (France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Vector_distances_in_diagram.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program compute dsitance 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.";
+
+ if ( argc < 3 )
+ {
+ std::cout << "Wrong number of parameters, the program will now terminate \n";
+ return 1;
+ }
+
+ int p = atoi( argv[3] );
+
+ 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 )
+ {
+ Vector_distances_in_diagram< euclidean_distance<double> >* l = new Vector_distances_in_diagram< euclidean_distance<double> >;
+ l->load_from_file( filenames[file_no] );
+ vectors.push_back( l );
+ }
+
+ //and now we will compute the scalar product of landscapes.
+
+ //first we prepare an array:
+ std::vector< std::vector< double > > distance( filenames.size() );
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ std::vector< double > v( filenames.size() , 0 );
+ distance[i] = v;
+ }
+
+ //and now we can compute the distances:
+ for ( size_t i = 0 ; i != vectors.size() ; ++i )
+ {
+ for ( size_t j = i ; j != vectors.size() ; ++j )
+ {
+ distance[i][j] = distance[j][i] = ((Vector_distances_in_diagram< euclidean_distance<double> >*)vectors[i])->distance( vectors[j] , p ) ;
+ }
+ }
+
+ //and now output the result to the screen and a file:
+ ofstream out;
+ out.open( "distance" );
+ for ( size_t i = 0 ; i != distance.size() ; ++i )
+ {
+ for ( size_t j = 0 ; j != distance.size() ; ++j )
+ {
+ cout << distance[i][j] << " ";
+ out << distance[i][j] << " ";
+ }
+ cout << endl;
+ out << endl;
+ }
+ out.close();
+
+ return 0;
+}
+
+
+
+
+
+
+
diff --git a/src/Gudhi_stat/example/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp b/src/Gudhi_stat/example/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp
new file mode 100644
index 00000000..c886d076
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp
@@ -0,0 +1,97 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA Sophia-Saclay (France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Vector_distances_in_diagram.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program compute scalar product of persistence vectors stored in a file (the file needs to be created beforehand). \n";
+ std::cout << "The parameters of this programs are names of files with persistence vectors.";
+
+ std::vector< const char* > filenames;
+ for ( int i = 1 ; i < argc ; ++i )
+ {
+ filenames.push_back( argv[i] );
+ }
+ std::vector< Vector_distances_in_diagram< euclidean_distance<double> >* > vectors;
+ vectors.reserve( filenames.size() );
+ for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no )
+ {
+ Vector_distances_in_diagram< euclidean_distance<double> >* l = new Vector_distances_in_diagram< euclidean_distance<double> >;
+ l->load_from_file( filenames[file_no] );
+ vectors.push_back( l );
+ }
+
+ //and now we will compute the scalar product of landscapes.
+
+ //first we prepare an array:
+ std::vector< std::vector< double > > scalar_product( filenames.size() );
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ std::vector< double > v( filenames.size() , 0 );
+ scalar_product[i] = v;
+ }
+
+ //and now we can compute the scalar product:
+ for ( size_t i = 0 ; i != vectors.size() ; ++i )
+ {
+ for ( size_t j = i ; j != vectors.size() ; ++j )
+ {
+ scalar_product[i][j] = scalar_product[j][i] = ((Vector_distances_in_diagram< euclidean_distance<double> >*)vectors[i])->compute_scalar_product( vectors[j] ) ;
+ }
+ }
+
+ //and now output the result to the screen and a file:
+ ofstream out;
+ out.open( "scalar_product" );
+ for ( size_t i = 0 ; i != scalar_product.size() ; ++i )
+ {
+ for ( size_t j = 0 ; j != scalar_product.size() ; ++j )
+ {
+ cout << scalar_product[i][j] << " ";
+ out << scalar_product[i][j] << " ";
+ }
+ cout << endl;
+ out << endl;
+ }
+ out.close();
+
+ //cleaning up
+ for ( size_t i = 0 ; i != vectors.size() ; ++i )
+ {
+ delete vectors[i];
+ }
+
+ return 0;
+}
diff --git a/src/Gudhi_stat/example/utilities/persistence_vectors/create_persistence_vectors.cpp b/src/Gudhi_stat/example/utilities/persistence_vectors/create_persistence_vectors.cpp
new file mode 100644
index 00000000..b800c872
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_vectors/create_persistence_vectors.cpp
@@ -0,0 +1,56 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA Sophia-Saclay (France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Vector_distances_in_diagram.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program creates persistence vectors of diagrams provided as an input. Please call this program with the names of files with persistence diagrams \n";
+ std::vector< const char* > filenames;
+ for ( int i = 1 ; i < argc ; ++i )
+ {
+ filenames.push_back( argv[i] );
+ }
+
+ std::cout << "Creating persistence vectors...\n";
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ 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/example/vector_representation.cpp b/src/Gudhi_stat/example/vector_representation.cpp
index 4e9cd1a6..358de1b0 100644
--- a/src/Gudhi_stat/example/vector_representation.cpp
+++ b/src/Gudhi_stat/example/vector_representation.cpp
@@ -50,7 +50,6 @@ int main( int argc , char** argv )
}
Vector_distances_in_diagram< euclidean_distance<double> > p( argv[1] , 100 );
-
cout << "This is a vector corresponding to the input persistence diagram : \n";
cout << p << endl;
diff --git a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_heat_maps.h b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_heat_maps.h
index 0910ae71..e758b30a 100644
--- a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_heat_maps.h
+++ b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_heat_maps.h
@@ -25,6 +25,9 @@
#include <sstream>
#include <iostream>
#include <cmath>
+#include <limits>
+#include <vector>
+#include <algorithm>
//gudhi include
#include <gudhi/abstract_classes/Abs_Vectorized_topological_data.h>
@@ -99,11 +102,37 @@ std::vector< std::vector<double> > create_Gaussian_filter( size_t pixel_radius ,
return kernel;
}
-double constant_function( std::pair< double , double >& point_in_diagram )
+
+/**
+ * There are various options to scale the poits depending on their location. One can for instance:
+ * (1) do nothing (scale all of them with the weight 1), as in the function constant_function
+ * (2) Scale them by the distance to the diagonal. This is implemented in function
+ * (3) Scale them with the square of their distance to diagonal. This is implemented in function
+ * (4) Scale them with
+**/
+
+double constant_function( const std::pair< double , double >& point_in_diagram )
{
return 1;
}
+double distance_from_diagonal( const std::pair< double , double >& point_in_diagram )
+{
+ //(point_in_diagram.first+point_in_diagram.second)/2.0
+ return sqrt( pow((point_in_diagram.first-(point_in_diagram.first+point_in_diagram.second)/2.0),2) + pow((point_in_diagram.second-(point_in_diagram.first+point_in_diagram.second)/2.0),2) );
+}
+
+double squared_distance_from_diagonal( const std::pair< double , double >& point_in_diagram )
+{
+ return pow((point_in_diagram.first-(point_in_diagram.first+point_in_diagram.second)/2.0),2) + pow((point_in_diagram.second-(point_in_diagram.first+point_in_diagram.second)/2.0),2);
+}
+
+double arc_tan_of_persistence_of_point( const std::pair< double , double >& point_in_diagram )
+{
+ return atan( point_in_diagram.second - point_in_diagram.first );
+}
+
+
class Persistence_heat_maps :
@@ -135,7 +164,7 @@ public:
* (6) a min x and y value of points that are to be taken into account. By default it is set to -1, in which case the program compute the values based on the data,
* (6) a max x and y value of points that are to be taken into account. By default it is set to -1, in which case the program compute the values based on the data.
**/
- Persistence_heat_maps( const std::vector< std::pair< double,double > > & interval , std::vector< std::vector<double> > filter = create_Gaussian_filter(5,1) , double (*scalling_function_with_respect_to_distance_from_diagonal)( std::pair< double , double >& point_in_diagram ) = constant_function, bool erase_below_diagonal = false , size_t number_of_pixels = 1000 , double min_ = -1 , double max_ = -1 );
+ Persistence_heat_maps( const std::vector< std::pair< double,double > > & interval , std::vector< std::vector<double> > filter = create_Gaussian_filter(5,1) , double (*scalling_function_with_respect_to_distance_from_diagonal)( const std::pair< double , double >& point_in_diagram ) = constant_function, bool erase_below_diagonal = false , size_t number_of_pixels = 1000 , double min_ = -1 , double max_ = -1 );
/**
* Construction that takes at the input a name of a file with persistence intervals, a filter (radius 5 by default), a scaling function (constant by default), a boolean value which determines if the area of image below diagonal should, or should not be erased (should by default). The next parameter is the number of pixels in each direction (set to 1000 by default). and min and max values of images (both set to -1 by defaulet. If this is the case, the program will pick the right values based on the data).
@@ -150,7 +179,7 @@ public:
* (6) a min x and y value of points that are to be taken into account. By default it is set to -1, in which case the program compute the values based on the data,
* (6) a max x and y value of points that are to be taken into account. By default it is set to -1, in which case the program compute the values based on the data.
**/
- Persistence_heat_maps( const char* name_of_file_with_names_of_files_with_interval , std::vector< std::vector<double> > filter = create_Gaussian_filter(5,1) , double (*scalling_function_with_respect_to_distance_from_diagonal)( std::pair< double , double >& point_in_diagram ) = constant_function, bool erase_below_diagonal = false , size_t number_of_pixels = 1000 , double min_ = -1 , double max_ = -1 );
+ Persistence_heat_maps( const char* name_of_file_with_names_of_files_with_interval , std::vector< std::vector<double> > filter = create_Gaussian_filter(5,1) , double (*scalling_function_with_respect_to_distance_from_diagonal)( const std::pair< double , double >& point_in_diagram ) = constant_function, bool erase_below_diagonal = false , size_t number_of_pixels = 1000 , double min_ = -1 , double max_ = -1 );
/**
@@ -176,7 +205,7 @@ public:
* In the first line, the values min and max of the image are stored
* In the next lines, we have the persistence images in a form of a bitmap image.
**/
- void write_to_file( const char* filename );
+ void print_to_file( const char* filename );
/**
* A function that load a heat map from file to the current object (and arase qhatever was stored in the current object before).
@@ -277,7 +306,7 @@ private:
std::vector< std::vector<double> > check_and_initialize_maps( const std::vector<Persistence_heat_maps*>& maps );
void construct( const std::vector< std::pair<double,double> >& intervals_ ,
std::vector< std::vector<double> > filter = create_Gaussian_filter(5,1),
- double (*scalling_function_with_respect_to_distance_from_diagonal)( std::pair< double , double >& point_in_diagram ) = constant_function,
+ double (*scalling_function_with_respect_to_distance_from_diagonal)( const std::pair< double , double >& point_in_diagram ) = constant_function,
bool erase_below_diagonal = false , size_t number_of_pixels = 1000 , double min_ = -1 , double max_ = -1 );
void set_up_parameters_for_basic_classes()
@@ -287,7 +316,7 @@ private:
}
//data
- double (*scalling_function_with_respect_to_distance_from_diagonal)( std::pair< double , double >& point_in_diagram );
+ double (*scalling_function_with_respect_to_distance_from_diagonal)( const std::pair< double , double >& point_in_diagram );
bool erase_below_diagonal;
double min_;
double max_;
@@ -298,7 +327,7 @@ private:
//if min_ == max_, then the program is requested to set up the values itself based on persistence intervals
void Persistence_heat_maps::construct( const std::vector< std::pair<double,double> >& intervals_ ,
std::vector< std::vector<double> > filter,
- double (*scalling_function_with_respect_to_distance_from_diagonal)( std::pair< double , double >& point_in_diagram ),
+ double (*scalling_function_with_respect_to_distance_from_diagonal)( const std::pair< double , double >& point_in_diagram ),
bool erase_below_diagonal , size_t number_of_pixels , double min_ , double max_ )
{
bool dbg = false;
@@ -307,8 +336,8 @@ void Persistence_heat_maps::construct( const std::vector< std::pair<double,doubl
if ( min_ == max_ )
{
//in this case, we want the program to set up the min_ and max_ values by itself.
- min_ = INT_MAX;
- max_ = -INT_MAX;
+ min_ = std::numeric_limits<int>::max();
+ max_ = -std::numeric_limits<int>::max();
for ( size_t i = 0 ; i != intervals_.size() ; ++i )
@@ -364,6 +393,7 @@ void Persistence_heat_maps::construct( const std::vector< std::pair<double,doubl
y_grid -= filter.size()/2;
//note that the numbers x_grid and y_grid may be negative.
+ double scaling_value = this->scalling_function_with_respect_to_distance_from_diagonal(intervals_[pt_nr]);
for ( size_t i = 0 ; i != filter.size() ; ++i )
{
@@ -376,7 +406,7 @@ void Persistence_heat_maps::construct( const std::vector< std::pair<double,doubl
((y_grid+j)>=0) && (y_grid+j<this->heat_map.size())
)
{
- this->heat_map[ y_grid+j ][ x_grid+i ] += filter[i][j];
+ this->heat_map[ y_grid+j ][ x_grid+i ] += scaling_value * filter[i][j];
if ( dbg )
{
std::cerr << "Position : (" << x_grid+i << "," << y_grid+j << ") got increased by the value : " << filter[i][j] << std::endl;
@@ -403,7 +433,7 @@ void Persistence_heat_maps::construct( const std::vector< std::pair<double,doubl
Persistence_heat_maps::Persistence_heat_maps( const std::vector< std::pair< double,double > > & interval ,
std::vector< std::vector<double> > filter,
- double (*scalling_function_with_respect_to_distance_from_diagonal)( std::pair< double , double >& point_in_diagram ),
+ double (*scalling_function_with_respect_to_distance_from_diagonal)( const std::pair< double , double >& point_in_diagram ),
bool erase_below_diagonal , size_t number_of_pixels , double min_ , double max_ )
{
this->construct( interval , filter , constant_function, erase_below_diagonal , number_of_pixels , min_ , max_ );
@@ -413,7 +443,7 @@ Persistence_heat_maps::Persistence_heat_maps( const std::vector< std::pair< doub
Persistence_heat_maps::Persistence_heat_maps( const char* name_of_file_with_names_of_files_with_interval ,
std::vector< std::vector<double> > filter,
- double (*scalling_function_with_respect_to_distance_from_diagonal)( std::pair< double , double >& point_in_diagram ),
+ double (*scalling_function_with_respect_to_distance_from_diagonal)( const std::pair< double , double >& point_in_diagram ),
bool erase_below_diagonal , size_t number_of_pixels , double min_ , double max_ )
{
std::vector< std::pair< double , double > > intervals_ = read_standard_file( name_of_file_with_names_of_files_with_interval );
@@ -545,7 +575,7 @@ void Persistence_heat_maps::plot( const char* filename )
-void Persistence_heat_maps::write_to_file( const char* filename )
+void Persistence_heat_maps::print_to_file( const char* filename )
{
ofstream out;
out.open( filename );
diff --git a/src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h b/src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h
index ce111426..56fad188 100644
--- a/src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h
+++ b/src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h
@@ -66,7 +66,8 @@ struct maximum_distance
/**
-* This is an implementation of idea presented in the paper by Steve, Matthew and Max.
+* This is an implementation of idea presented in the paper by Steve, Matthew and Max. The parameter of the class is the class that computes distance used to construct the vectors. The typical function is
+* either Eucludean of maximum (Manhattan) distance.
**/
template <typename F>
@@ -136,6 +137,19 @@ public:
**/
void write_to_file( const char* filename );
+ /**
+ * Write a vector to a file.
+ **/
+ void print_to_file( const char* filename )
+ {
+ this->write_to_file(filename);
+ }
+
+ /**
+ * Loading a vector to a file.
+ **/
+ void load_from_file( const char* filename );
+
//concretization of abstract methods:
double project_to_R( int number_of_function );
std::vector<double> vectorize( int number_of_function );
@@ -455,6 +469,28 @@ void Vector_distances_in_diagram<F>::write_to_file( const char* filename )
}
template < typename F>
+void Vector_distances_in_diagram<F>::load_from_file( const char* filename )
+{
+ //check if the file exist.
+ if ( !( access( filename, F_OK ) != -1 ) )
+ {
+ cerr << "The file : " << filename << " do not exist. The program will now terminate \n";
+ throw "The file from which you are trying to read the persistence landscape do not exist. The program will now terminate \n";
+ }
+ std::ifstream in;
+ in.open( filename );
+
+ double number;
+ while ( true )
+ {
+ in >> number;
+ if ( in.eof() )break;
+ this->sorted_vector_of_distnaces.push_back(number);
+ }
+ in.close();
+}
+
+template < typename F>
double Vector_distances_in_diagram<F>::compute_scalar_product( const Abs_Topological_data_with_scalar_product* second )
{
Vector_distances_in_diagram<F>* second_vector = (Vector_distances_in_diagram<F>*)second;
diff --git a/src/Gudhi_stat/test/persistence_heat_maps_test.cpp b/src/Gudhi_stat/test/persistence_heat_maps_test.cpp
index 78297cea..505b1912 100644
--- a/src/Gudhi_stat/test/persistence_heat_maps_test.cpp
+++ b/src/Gudhi_stat/test/persistence_heat_maps_test.cpp
@@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(check_construction_of_heat_maps)
{
std::vector< std::vector<double> > filter = create_Gaussian_filter(100,1);
Persistence_heat_maps p( "data/file_with_diagram" , filter , constant_function, false , 1000 , 0 , 1 );
- p.write_to_file( "data/persistence_heat_map_from_file_with_diagram" );
+ p.print_to_file( "data/persistence_heat_map_from_file_with_diagram" );
Persistence_heat_maps q;
q.load_from_file( "data/persistence_heat_map_from_file_with_diagram" );
diff --git a/src/Gudhi_stat/test/persistence_lanscapes_on_grid_test.cpp b/src/Gudhi_stat/test/persistence_lanscapes_on_grid_test.cpp
index f7e58fe4..fb95b9d1 100644
--- a/src/Gudhi_stat/test/persistence_lanscapes_on_grid_test.cpp
+++ b/src/Gudhi_stat/test/persistence_lanscapes_on_grid_test.cpp
@@ -27,7 +27,7 @@
#include <boost/test/unit_test.hpp>
#include <gudhi/reader_utils.h>
#include <gudhi/abstract_classes/Abs_Topological_data.h>
-#include <gudhi/concretizations/Persistence_landscapes_on_grid.h>
+#include <gudhi/concretizations/Persistence_landscape_on_grid.h>
#include <iostream>
diff --git a/src/Gudhi_stat/test/persistence_lanscapes_test.cpp b/src/Gudhi_stat/test/persistence_lanscapes_test.cpp
index 2e4369ab..8a7d0ce1 100644
--- a/src/Gudhi_stat/test/persistence_lanscapes_test.cpp
+++ b/src/Gudhi_stat/test/persistence_lanscapes_test.cpp
@@ -27,7 +27,7 @@
#include <boost/test/unit_test.hpp>
#include <gudhi/reader_utils.h>
#include <gudhi/abstract_classes/Abs_Topological_data.h>
-#include <gudhi/concretizations/Persistence_landscapes.h>
+#include <gudhi/concretizations/Persistence_landscape.h>
#include <iostream>