summaryrefslogtreecommitdiff
path: root/src/Gudhi_stat
diff options
context:
space:
mode:
authorpdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-09-22 14:23:20 +0000
committerpdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-09-22 14:23:20 +0000
commit1df5ef4350bd17588bf431eb809fff6818bff93e (patch)
tree577551bd0f8004775e0a4092aecdf39655946933 /src/Gudhi_stat
parent7d53fb8594b46757e783816fd4eb41c868ce3dde (diff)
a few utilities to gudhi stat
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/gudhi_stat@1539 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: f7828137943b97025df785ff0db02ba03e7ee1dc
Diffstat (limited to 'src/Gudhi_stat')
-rw-r--r--src/Gudhi_stat/example/CMakeLists.txt50
-rw-r--r--src/Gudhi_stat/example/persistence_intervals.cpp8
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_intervals/aaa2
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_intervals/aaa_Gnuplot_script12
-rwxr-xr-xsrc/Gudhi_stat/example/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagrambin0 -> 57077 bytes
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp51
-rwxr-xr-xsrc/Gudhi_stat/example/utilities/persistence_intervals/compute_number_of_dominant_intervalsbin0 -> 57320 bytes
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp57
-rwxr-xr-xsrc/Gudhi_stat/example/utilities/persistence_intervals/plot_histogram_of_intervals_lengthsbin0 -> 61940 bytes
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp69
-rwxr-xr-xsrc/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_Betti_numebrsbin0 -> 62043 bytes
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp93
-rwxr-xr-xsrc/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_intervalsbin0 -> 66379 bytes
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_intervals.cpp59
-rwxr-xr-xsrc/Gudhi_stat/example/utilities/persistence_landscapes/average_landscapesbin0 -> 100003 bytes
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_landscapes/average_landscapes.cpp74
-rwxr-xr-xsrc/Gudhi_stat/example/utilities/persistence_landscapes/create_landscapesbin0 -> 103822 bytes
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_landscapes/create_landscapes.cpp56
-rwxr-xr-xsrc/Gudhi_stat/example/utilities/persistence_landscapes/plot_landscapesbin0 -> 99665 bytes
-rw-r--r--src/Gudhi_stat/example/utilities/persistence_landscapes/plot_landscapes.cpp50
20 files changed, 563 insertions, 18 deletions
diff --git a/src/Gudhi_stat/example/CMakeLists.txt b/src/Gudhi_stat/example/CMakeLists.txt
index 1e6062fb..a0390875 100644
--- a/src/Gudhi_stat/example/CMakeLists.txt
+++ b/src/Gudhi_stat/example/CMakeLists.txt
@@ -7,23 +7,49 @@ target_link_libraries(persistence_landscape_on_grid ${Boost_SYSTEM_LIBRARY})
add_executable ( persistence_landscape persistence_landscape.cpp )
target_link_libraries(persistence_landscape ${Boost_SYSTEM_LIBRARY})
-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 ( persistence_intervals persistence_intervals.cpp )
target_link_libraries(persistence_intervals ${Boost_SYSTEM_LIBRARY})
-add_executable ( plot_persistence_intervals plot_persistence_intervals.cpp )
-target_link_libraries( plot_persistence_intervals ${Boost_SYSTEM_LIBRARY})
-
add_executable ( vector_representation vector_representation.cpp )
target_link_libraries(vector_representation ${Boost_SYSTEM_LIBRARY})
add_executable ( persistence_heat_maps persistence_heat_maps.cpp )
target_link_libraries(persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
+
+
+##UTILITIES:
+
+#persitence diagrams
+add_executable ( utilities/persistence_intervals/plot_persistence_intervals utilities/persistence_intervals/plot_persistence_intervals.cpp )
+target_link_libraries( utilities/persistence_intervals/plot_persistence_intervals ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp )
+target_link_libraries( utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( utilities/persistence_intervals/compute_number_of_dominant_intervals utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp )
+target_link_libraries( utilities/persistence_intervals/compute_number_of_dominant_intervals ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( utilities/persistence_intervals/plot_histogram_of_intervals_lengths utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp )
+target_link_libraries( utilities/persistence_intervals/plot_histogram_of_intervals_lengths ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( utilities/persistence_intervals/plot_persistence_Betti_numebrs utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp )
+target_link_libraries( utilities/persistence_intervals/plot_persistence_Betti_numebrs ${Boost_SYSTEM_LIBRARY})
+
+#when we have bottleneck and wasserstein distance computations, add suitable programs here.
+
+
+#persitence landscapes
+add_executable ( utilities/persistence_landscapes/average_landscapes utilities/persistence_landscapes/average_landscapes.cpp )
+target_link_libraries(utilities/persistence_landscapes/average_landscapes ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( utilities/persistence_landscapes/create_landscapes utilities/persistence_landscapes/create_landscapes.cpp )
+target_link_libraries(utilities/persistence_landscapes/create_landscapes ${Boost_SYSTEM_LIBRARY})
+
+add_executable ( utilities/persistence_landscapes/plot_landscapes utilities/persistence_landscapes/plot_landscapes.cpp )
+target_link_libraries(utilities/persistence_landscapes/plot_landscapes ${Boost_SYSTEM_LIBRARY})
+
+#persitence landscapes on a grid
+
+#persitence images
+
+#persitence vectors
diff --git a/src/Gudhi_stat/example/persistence_intervals.cpp b/src/Gudhi_stat/example/persistence_intervals.cpp
index cf8c37c6..cbd4020d 100644
--- a/src/Gudhi_stat/example/persistence_intervals.cpp
+++ b/src/Gudhi_stat/example/persistence_intervals.cpp
@@ -33,9 +33,6 @@
using namespace Gudhi;
using namespace Gudhi::Gudhi_stat;
-
-double epsilon = 0.0000005;
-
using namespace std;
@@ -48,8 +45,7 @@ int main( int argc , char** argv )
}
Persistence_intervals p( argv[1] );
- std::pair<double,double> min_max_ = p.min_max();
-
+ std::pair<double,double> min_max_ = p.min_max();
cout << "Birth-death range : " << min_max_.first << " " << min_max_.second << endl;
@@ -59,8 +55,8 @@ int main( int argc , char** argv )
{
cout << dominant_ten_intervals_length[i] << endl;
}
- std::vector< std::pair<double,double> > ten_dominant_intervals = p.dominant_intervals( 10 );
+ std::vector< std::pair<double,double> > ten_dominant_intervals = p.dominant_intervals( 10 );
cout << "Here are the dominant intervals : " << endl;
for ( size_t i = 0 ; i != ten_dominant_intervals.size() ; ++i )
{
diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/aaa b/src/Gudhi_stat/example/utilities/persistence_intervals/aaa
new file mode 100644
index 00000000..c0db80ab
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_intervals/aaa
@@ -0,0 +1,2 @@
+1 2
+5 6 \ No newline at end of file
diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/aaa_Gnuplot_script b/src/Gudhi_stat/example/utilities/persistence_intervals/aaa_Gnuplot_script
new file mode 100644
index 00000000..af68b9b9
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_intervals/aaa_Gnuplot_script
@@ -0,0 +1,12 @@
+set xrange [0.95 : 6.0505]
+set yrange [0 : 1.01]
+plot '-' using 1:2 notitle with lp
+1 0
+1 1
+2 1
+2 0
+5 0
+5 1
+6 1
+6 0
+
diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram b/src/Gudhi_stat/example/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram
new file mode 100755
index 00000000..8c0ac6f0
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram
Binary files differ
diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp b/src/Gudhi_stat/example/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp
new file mode 100644
index 00000000..6ae605d2
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp
@@ -0,0 +1,51 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA 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/reader_utils.h>
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_intervals.h>
+
+#include <iostream>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+using namespace std;
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program compute minimum birth and the maximum death time for a collection of persistence intervals \n";
+ if ( argc != 2 )
+ {
+ cout << "To run this program, please provide the name of a file with persistence diagram \n";
+ return 1;
+ }
+
+ Persistence_intervals p( argv[1] );
+ std::pair<double,double> min_max_ = p.min_max();
+ cout << "Birth-death range : min: " << min_max_.first << ", max: " << min_max_.second << endl;
+}
diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/compute_number_of_dominant_intervals b/src/Gudhi_stat/example/utilities/persistence_intervals/compute_number_of_dominant_intervals
new file mode 100755
index 00000000..9be7cfad
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_intervals/compute_number_of_dominant_intervals
Binary files differ
diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp b/src/Gudhi_stat/example/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp
new file mode 100644
index 00000000..6e6a9c88
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp
@@ -0,0 +1,57 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA 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/reader_utils.h>
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_intervals.h>
+
+#include <iostream>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+using namespace std;
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program compute the dominant intervals. A number of intervals to be displayed is a parameter of this program. \n";
+ if ( argc != 3 )
+ {
+ cout << "To run this program, please provide the name of a file with persistence diagram and number of dominant intervals you would like to get \n";
+ return 1;
+ }
+
+ Persistence_intervals p( argv[1] );
+ std::vector< std::pair<double,double> > dominant_intervals = p.dominant_intervals( atoi( argv[2] ) );
+ cout << "Here are the dominant intervals : " << endl;
+ for ( size_t i = 0 ; i != dominant_intervals.size() ; ++i )
+ {
+ cout << " " << dominant_intervals[i].first<< "," << dominant_intervals[i].second << " "<< endl;
+ }
+
+ return 0;
+}
diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/plot_histogram_of_intervals_lengths b/src/Gudhi_stat/example/utilities/persistence_intervals/plot_histogram_of_intervals_lengths
new file mode 100755
index 00000000..d1e6d1a4
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_intervals/plot_histogram_of_intervals_lengths
Binary files differ
diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp b/src/Gudhi_stat/example/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp
new file mode 100644
index 00000000..88c916d8
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp
@@ -0,0 +1,69 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA 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/reader_utils.h>
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_intervals.h>
+
+#include <iostream>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+using namespace std;
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program compute a histogram of barcode's length. A number of bins in the histogram is a parameter of this program. \n";
+ if ( argc != 3 )
+ {
+ cout << "To run this program, please provide the name of a file with persistence diagram and number of dominant intervals you would like to get \n";
+ return 1;
+ }
+
+ Persistence_intervals p( argv[1] );
+ std::vector< std::pair<double,double> > dominant_intervals = p.dominant_intervals( atoi( argv[2] ) );
+ std::vector< size_t > histogram = p.histograms_of_lengths( 10 );
+
+ std::stringstream gnuplot_script;
+ gnuplot_script << argv[1] << "_Gnuplot_script";
+ ofstream out;
+ out.open( gnuplot_script.str().c_str() );
+
+ out << "set style data histogram" << std::endl;
+ out << "set style histogram cluster gap 1" << std::endl;
+ out << "set style fill solid border -1" << std::endl;
+ out << "plot '-' notitle" << std::endl;
+ for ( size_t i = 0 ; i != histogram.size() ; ++i )
+ {
+ out << histogram[i] << std::endl;
+ }
+ out << endl;
+ std::cout << "To vizualize, open gnuplot and type: \'load " << gnuplot_script.str().c_str() << "\'" << std::endl;
+ out.close();
+ return 0;
+}
diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_Betti_numebrs b/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_Betti_numebrs
new file mode 100755
index 00000000..1cf0465f
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_Betti_numebrs
Binary files differ
diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp b/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp
new file mode 100644
index 00000000..49c0f601
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp
@@ -0,0 +1,93 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA 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/reader_utils.h>
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_intervals.h>
+
+#include <iostream>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+using namespace std;
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program compute a plot of persistence Betti numbers. The input parameter is a file with persistence intervals. \n";
+ if ( argc != 2 )
+ {
+ cout << "To run this program, please provide the name of a file with persistence diagram and number of dominant intervals you would like to get \n";
+ return 1;
+ }
+
+
+
+ std::stringstream gnuplot_script;
+ gnuplot_script << argv[1] << "_Gnuplot_script";
+ ofstream out;
+ out.open( gnuplot_script.str().c_str() );
+
+ Persistence_intervals p( argv[1] );
+ std::vector< std::pair< double , size_t > > pbns = p.compute_persistent_betti_numbers();
+
+ //set up the ranges so that we see the image well.
+ double xRangeBegin = pbns[0].first;
+ double xRangeEnd = pbns[ pbns.size()-1 ].first;
+ double yRangeBegin = 0;
+ double yRangeEnd = 0;
+ for ( size_t i = 0 ; i != pbns.size() ; ++i )
+ {
+ if ( pbns[i].second > yRangeEnd )yRangeEnd = pbns[i].second;
+ }
+ xRangeBegin -= (xRangeEnd -xRangeBegin)/100.0;
+ xRangeEnd += (xRangeEnd -xRangeBegin)/100.0;
+ yRangeEnd += yRangeEnd/100;
+
+
+ out << "set xrange [" << xRangeBegin << " : " << xRangeEnd << "]" << endl;
+ out << "set yrange [" << yRangeBegin << " : " << yRangeEnd << "]" << endl;
+ out << "plot '-' using 1:2 notitle with lp " << std::endl;
+ double previous_y = 0;
+ for ( size_t i = 0 ; i != pbns.size() ; ++i )
+ {
+ out << pbns[i].first << " " << previous_y << endl;
+ out << pbns[i].first << " " << pbns[i].second << std::endl;
+ previous_y = pbns[i].second;
+ }
+ out << endl;
+ out.close();
+
+ for ( size_t i = 0 ; i != pbns.size() ; ++i )
+ {
+ cout << pbns[i].first << " " << pbns[i].second << std::endl;
+ }
+
+ std::cout << "To vizualize, open gnuplot and type: \'load " << gnuplot_script.str().c_str() << "\'" << std::endl;
+
+ return 0;
+}
diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_intervals b/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_intervals
new file mode 100755
index 00000000..95e85258
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_intervals
Binary files differ
diff --git a/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_intervals.cpp b/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_intervals.cpp
new file mode 100644
index 00000000..c4dd7284
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_intervals/plot_persistence_intervals.cpp
@@ -0,0 +1,59 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA 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/reader_utils.h>
+#include <gudhi/abstract_classes/Abs_Topological_data.h>
+#include <gudhi/concretizations/Persistence_intervals.h>
+
+#include <iostream>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+
+double epsilon = 0.0000005;
+
+using namespace std;
+
+
+int main( int argc , char** argv )
+{
+ if ( argc != 2 )
+ {
+ cout << "To run this program, please provide the name of a file with persistence diagram \n";
+ return 1;
+ }
+ Persistence_intervals b( argv[1] );
+ b.plot( argv[1] );
+ return 0;
+}
+
+
+
+
+
+
+
diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes/average_landscapes b/src/Gudhi_stat/example/utilities/persistence_landscapes/average_landscapes
new file mode 100755
index 00000000..fdc8552e
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_landscapes/average_landscapes
Binary files differ
diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes/average_landscapes.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes/average_landscapes.cpp
new file mode 100644
index 00000000..ac3b6432
--- /dev/null
+++ b/src/Gudhi_stat/example/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 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_landscapes.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 )
+ {
+ Persistence_landscape* l = new Persistence_landscape;
+ l->load_landscape_from_file( filenames[i] );
+ lands.push_back( (Abs_Topological_data_with_averages*)l );
+ }
+
+ Persistence_landscape av;
+ av.compute_average( lands );
+
+ av.print_to_file( "average" );
+
+ 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/create_landscapes b/src/Gudhi_stat/example/utilities/persistence_landscapes/create_landscapes
new file mode 100755
index 00000000..c82b0e7e
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_landscapes/create_landscapes
Binary files differ
diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes/create_landscapes.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes/create_landscapes.cpp
new file mode 100644
index 00000000..0a5df3b9
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_landscapes/create_landscapes.cpp
@@ -0,0 +1,56 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA 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_landscapes.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program creates persistence landscapes of diagrams provided as an input. Please call this program with the names of files with persistence diagrams \n";
+ std::vector< const char* > filenames;
+ for ( int i = 1 ; i < argc ; ++i )
+ {
+ filenames.push_back( argv[i] );
+ }
+
+ std::cout << "Creating persistence landscapes...\n";
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ Persistence_landscape l( filenames[i] , 1 );
+ std::stringstream ss;
+ ss << filenames[i] << ".land";
+ l.print_to_file( ss.str().c_str() );
+ }
+ std::cout << "Done \n";
+ return 0;
+}
diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes/plot_landscapes b/src/Gudhi_stat/example/utilities/persistence_landscapes/plot_landscapes
new file mode 100755
index 00000000..ff049c9a
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_landscapes/plot_landscapes
Binary files differ
diff --git a/src/Gudhi_stat/example/utilities/persistence_landscapes/plot_landscapes.cpp b/src/Gudhi_stat/example/utilities/persistence_landscapes/plot_landscapes.cpp
new file mode 100644
index 00000000..55575b97
--- /dev/null
+++ b/src/Gudhi_stat/example/utilities/persistence_landscapes/plot_landscapes.cpp
@@ -0,0 +1,50 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA 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_landscapes.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;
+}