summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Doxyfile3
-rw-r--r--src/Gudhi_stat/doc/average_landscape.pngbin0 -> 14917 bytes
-rw-r--r--src/Gudhi_stat/include/gudhi/permutation_test.h2
-rw-r--r--src/Gudhi_stat/include/gudhi/persistence_representations/PSSK.h12
-rw-r--r--src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_heat_maps.h16
-rw-r--r--src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_intervals.h39
-rw-r--r--src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_intervals_with_distances.h76
-rw-r--r--src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape.h21
-rw-r--r--src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape_on_grid.h82
-rw-r--r--src/Gudhi_stat/include/gudhi/persistence_representations/persistence_vectors.h20
-rw-r--r--src/Gudhi_stat/include/gudhi/topological_process.h5
-rw-r--r--src/Gudhi_stat/test/persistence_lanscapes_on_grid_test.cpp35
-rw-r--r--src/Gudhi_stat/utilities/Multiplicative_bootstrap.cpp2
-rw-r--r--src/Gudhi_stat/utilities/permutation_test.cpp2
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp20
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp18
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp14
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp18
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/create_pssk.cpp17
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt15
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp24
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/compute_bottleneck_distance.cpp115
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp15
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp13
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_Betti_numbers.cpp (renamed from src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp)16
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_intervals.cpp16
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes/create_landscapes.cpp17
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp17
-rw-r--r--src/Gudhi_stat/utilities/persistence_vectors/create_persistence_vectors.cpp16
30 files changed, 506 insertions, 161 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3779cb80..c94110a6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -53,6 +53,7 @@ add_subdirectory(example/Subsampling)
add_subdirectory(example/Tangential_complex)
add_subdirectory(example/Bottleneck_distance)
add_subdirectory(example/Gudhi_stat)
+add_subdirectory(example/Gudhi_stat/utilities)
# data points generator
add_subdirectory(data/points/generator)
diff --git a/src/Doxyfile b/src/Doxyfile
index d2d0a447..f3782148 100644
--- a/src/Doxyfile
+++ b/src/Doxyfile
@@ -851,7 +851,8 @@ IMAGE_PATH = doc/Skeleton_blocker/ \
doc/Subsampling/ \
doc/Spatial_searching/ \
doc/Tangential_complex/ \
- doc/Bottleneck_distance/
+ doc/Bottleneck_distance/ \
+ doc/Gudhi_stat/
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
diff --git a/src/Gudhi_stat/doc/average_landscape.png b/src/Gudhi_stat/doc/average_landscape.png
new file mode 100644
index 00000000..ea59926b
--- /dev/null
+++ b/src/Gudhi_stat/doc/average_landscape.png
Binary files differ
diff --git a/src/Gudhi_stat/include/gudhi/permutation_test.h b/src/Gudhi_stat/include/gudhi/permutation_test.h
index b4c1a8ba..69b0790b 100644
--- a/src/Gudhi_stat/include/gudhi/permutation_test.h
+++ b/src/Gudhi_stat/include/gudhi/permutation_test.h
@@ -37,6 +37,8 @@ namespace Gudhi
namespace Gudhi_stat
{
+//TODO change the reading procedures so that they accept the dimension value (by default std::nnumeric_limits<unsigned>::max().
+
template <typename Representation_of_persistence>
double permutation_test( const std::vector<Representation_of_persistence*>& data_1 , const std::vector<Representation_of_persistence*>& data_2 , size_t number_of_permutations , double exponent = 1 )
{
diff --git a/src/Gudhi_stat/include/gudhi/persistence_representations/PSSK.h b/src/Gudhi_stat/include/gudhi/persistence_representations/PSSK.h
index 7a299a86..d2fd3a86 100644
--- a/src/Gudhi_stat/include/gudhi/persistence_representations/PSSK.h
+++ b/src/Gudhi_stat/include/gudhi/persistence_representations/PSSK.h
@@ -53,10 +53,18 @@ public:
}
- PSSK( const char* filename , std::vector< std::vector<double> > filter = create_Gaussian_filter(5,1) , size_t number_of_pixels = 1000 , double min_ = -1 , double max_ = -1 ):
+ PSSK( const char* filename , std::vector< std::vector<double> > filter = create_Gaussian_filter(5,1) , size_t number_of_pixels = 1000 , double min_ = -1 , double max_ = -1 , unsigned dimension = std::numeric_limits<unsigned>::max() ):
Persistence_heat_maps()
{
- std::vector< std::pair< double , double > > intervals_ = read_standard_persistence_file( filename );
+ std::vector< std::pair< double , double > > intervals_;
+ if ( dimension == std::numeric_limits<unsigned>::max() )
+ {
+ intervals_ = read_persistence_intervals_in_one_dimension_from_file( filename );
+ }
+ else
+ {
+ intervals_ = read_persistence_intervals_in_one_dimension_from_file( filename , dimension );
+ }
this->construct( intervals_ , filter , number_of_pixels , min_ , max_ );
}
diff --git a/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_heat_maps.h b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_heat_maps.h
index f82f3100..3cfd52f5 100644
--- a/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_heat_maps.h
+++ b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_heat_maps.h
@@ -230,14 +230,14 @@ public:
**/
/**
* Construction that takes at the input the following parameters:
- * (1) A a name of a file with persistence intervals. The file shold be readable by the function read_standard_persistence_file. All other parameters are optional. They are:
+ * (1) A a name of a file with persistence intervals. The file shold be readable by the function read_persistence_intervals_in_one_dimension_from_file. All other parameters are optional. They are:
* (2) a Gausian filter generated by create_Gaussian_filter filter (the default value of this vaiable is a Gaussian filter of a radius 5),
* (3) a boolean value which determines if the area of image below diagonal should, or should not be erased (it will be erased by default).
* (4) a number of pixels in each direction (set to 1000 by default).
* (5) a min x and y value of points that are to be taken into account. By default it is set to std::numeric_limits<double>::max(), 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 std::numeric_limits<double>::max(), in which case the program compute the values based on the data.
**/
- Persistence_heat_maps( const char* filename , std::vector< std::vector<double> > filter = create_Gaussian_filter(5,1), bool erase_below_diagonal = false , size_t number_of_pixels = 1000 , double min_ = std::numeric_limits<double>::max() , double max_ = std::numeric_limits<double>::max() );
+ Persistence_heat_maps( const char* filename , std::vector< std::vector<double> > filter = create_Gaussian_filter(5,1), bool erase_below_diagonal = false , size_t number_of_pixels = 1000 , double min_ = std::numeric_limits<double>::max() , double max_ = std::numeric_limits<double>::max() , unsigned dimension = std::numeric_limits<unsigned>::max() );
/**
@@ -695,9 +695,17 @@ Persistence_heat_maps<Scalling_of_kernels>::Persistence_heat_maps( const std::ve
template <typename Scalling_of_kernels>
Persistence_heat_maps<Scalling_of_kernels>::Persistence_heat_maps( const char* filename ,
std::vector< std::vector<double> > filter,
- bool erase_below_diagonal , size_t number_of_pixels , double min_ , double max_ )
+ bool erase_below_diagonal , size_t number_of_pixels , double min_ , double max_ , unsigned dimension )
{
- std::vector< std::pair< double , double > > intervals_ = read_standard_persistence_file( filename );
+ std::vector< std::pair< double , double > > intervals_;
+ if ( dimension == std::numeric_limits<unsigned>::max() )
+ {
+ intervals_ = read_persistence_intervals_in_one_dimension_from_file( filename );
+ }
+ else
+ {
+ intervals_ = read_persistence_intervals_in_one_dimension_from_file( filename , dimension );
+ }
this->construct( intervals_ , filter, erase_below_diagonal , number_of_pixels , min_ , max_ );
this->set_up_parameters_for_basic_classes();
}
diff --git a/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_intervals.h b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_intervals.h
index 2c3e4803..2ff4d7f7 100644
--- a/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_intervals.h
+++ b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_intervals.h
@@ -25,8 +25,6 @@
//gudhi include
#include <gudhi/read_persistence_from_file.h>
-//Bottleneck distance:
-//#include <gudhi/Bottleneck.h>
//standard include
#include <limits>
@@ -51,8 +49,9 @@ public:
/**
* This is a constructor of a class Persistence_intervals from a text file. Each line of the input file is supposed to contain two numbers of a type doube (or convertable to double)
* representing the birth and the death of the persistence interval. If the pairs are not sorted so that birth <= death, then the constructor will sort then that way.
+ * * The second parameter of a constructor is a dimension of intervals to be read from a file. If your file contains only birt-death pairs, use the default value.
**/
- Persistence_intervals( const char* filename );
+ Persistence_intervals( const char* filename , unsigned dimension = std::numeric_limits<unsigned>::max() );
/**
* This is a constructor of a class Persistence_intervals from a vector of pairs. Each pair is assumed to represent a persistence interval. We assume that the first elemnets of pairs
@@ -247,26 +246,6 @@ public:
return this->number_of_functions_for_vectorization;
}
- /**
- *Computations of distance from the current persistnce diagram to the persistence diagram given as a parameter of this function.
- *The last but one parameter, power, is here in case we would like to compute p=th Wasserstein distance. At the moment, this method only implement Bottleneck distance,
- * which is infinity Wasserstein distance. Therefore any power which is not the default std::numeric_limits< double >::max() will be ignored and an
- * exception will be thrown.
- * The last parameter, tolerance, it is an additiv error of the approimation, set by default to zero.
- **/
- double distance( const Persistence_intervals& second , double power = std::numeric_limits< double >::max() , double tolerance = 0) const
- {
- if ( power >= std::numeric_limits< double >::max() )
- {
- //return Gudhi::persistence_diagram::bottleneck_distance(this->intervals, second.intervals, tolerance);
- return 1;
- }
- else
- {
- std::cerr << "At the moment Gudhi do not support Wasserstein distances. We only support Bottleneck distance." << std::endl;
- throw "At the moment Gudhi do not support Wasserstein distances. We only support Bottleneck distance.";
- }
- }
//end of implementation of functions needed for concepts.
//end of implementation of functions needed for concepts.
@@ -303,7 +282,7 @@ protected:
};
-Persistence_intervals::Persistence_intervals( const char* filename )
+Persistence_intervals::Persistence_intervals( const char* filename , unsigned dimension )
{
//bool dbg = false;
//ifstream in;
@@ -336,10 +315,14 @@ Persistence_intervals::Persistence_intervals( const char* filename )
// }
//}
//in.close();
- //standard file with barcode
- this->intervals = read_standard_persistence_file( filename );
- //gudhi file with barcode
- //this->intervals = read_gudhi_persistence_file_in_one_dimension( filename , dimension );
+ if ( dimension == std::numeric_limits<unsigned>::max() )
+ {
+ this->intervals = read_persistence_intervals_in_one_dimension_from_file( filename );
+ }
+ else
+ {
+ this->intervals = read_persistence_intervals_in_one_dimension_from_file( filename , dimension );
+ }
this->set_up_numbers_of_functions_for_vectorization_and_projections_to_reals();
}//Persistence_intervals
diff --git a/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_intervals_with_distances.h b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_intervals_with_distances.h
new file mode 100644
index 00000000..84a95e95
--- /dev/null
+++ b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_intervals_with_distances.h
@@ -0,0 +1,76 @@
+/* This file is part of the Gudhi hiLibrary. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA (France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef Persistence_intervals_WITH_DISTANCES_H_
+#define Persistence_intervals_WITH_DISTANCES_H_
+
+
+#include <gudhi/persistence_representations/Persistence_intervals.h>
+#include <gudhi/Bottleneck.h>
+
+namespace Gudhi
+{
+namespace Gudhi_stat
+{
+
+class Persistence_intervals_with_distances : public Persistence_intervals
+{
+public:
+ /**
+ * This is a constructor of a class Persistence_intervals_with_distances from a text file. Each line of the input file is supposed to contain two numbers of a type doube (or convertable to double)
+ * representing the birth and the death of the persistence interval. If the pairs are not sorted so that birth <= death, then the constructor will sort then that way.
+ * The second parameter of a constructor is a dimension of intervals to be read from a file. If your file contains only birt-death pairs, use the default value.
+ **/
+ Persistence_intervals_with_distances( const char* filename , unsigned dimension = std::numeric_limits<unsigned>::max() ):Persistence_intervals( filename , dimension ){}
+
+ /**
+ * This is a constructor of a class Persistence_intervals_with_distances from a vector of pairs. Each pair is assumed to represent a persistence interval. We assume that the first elemnets of pairs
+ * are smaller or equal the second elements of pairs.
+ **/
+ Persistence_intervals_with_distances( const std::vector< std::pair< double,double > >& intervals ):Persistence_intervals( intervals ){}
+
+ /**
+ *Computations of distance from the current persistnce diagram to the persistence diagram given as a parameter of this function.
+ *The last but one parameter, power, is here in case we would like to compute p=th Wasserstein distance. At the moment, this method only implement Bottleneck distance,
+ * which is infinity Wasserstein distance. Therefore any power which is not the default std::numeric_limits< double >::max() will be ignored and an
+ * exception will be thrown.
+ * The last parameter, tolerance, it is an additiv error of the approimation, set by default to zero.
+ **/
+ double distance( const Persistence_intervals_with_distances& second , double power = std::numeric_limits< double >::max() , double tolerance = 0) const
+ {
+ if ( power >= std::numeric_limits< double >::max() )
+ {
+ return Gudhi::persistence_diagram::bottleneck_distance(this->intervals, second.intervals, tolerance);
+ }
+ else
+ {
+ std::cerr << "At the moment Gudhi do not support Wasserstein distances. We only support Bottleneck distance." << std::endl;
+ throw "At the moment Gudhi do not support Wasserstein distances. We only support Bottleneck distance.";
+ }
+ }
+};
+
+
+}//namespace gudhi stat
+}//namespace gudhi
+
+#endif
diff --git a/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape.h b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape.h
index 0d8fe5fe..681f5d8d 100644
--- a/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape.h
+++ b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape.h
@@ -80,7 +80,7 @@ public:
* Constructor that reads persistence intervals from file and creates persistence landscape. The format of the input file is the following: in each line we put birth-death pair. Last line is assumed
* to be empty. Even if the points within a line are not ordered, they will be ordered while the input is read.
**/
- Persistence_landscape(const char* filename , size_t dimension = 0);
+ Persistence_landscape(const char* filename , size_t dimension = std::numeric_limits<unsigned>::max() );
@@ -548,13 +548,18 @@ Persistence_landscape::Persistence_landscape(const char* filename , size_t dimen
if ( dbg )
{
std::cerr << "Using constructor : Persistence_landscape(char* filename)" << std::endl;
- }
- //standard file with barcode
- //std::vector< std::pair< double , double > > barcode = read_standard_persistence_file( filename );
- //gudhi file with barcode
- std::vector< std::pair< double , double > > barcode = read_gudhi_persistence_file_in_one_dimension( filename , dimension );
- this->construct_persistence_landscape_from_barcode( barcode );
- this->set_up_numbers_of_functions_for_vectorization_and_projections_to_reals();
+ }
+ std::vector< std::pair< double , double > > barcode;
+ if ( dimension == std::numeric_limits<unsigned>::max() )
+ {
+ barcode = read_persistence_intervals_in_one_dimension_from_file( filename );
+ }
+ else
+ {
+ barcode = read_persistence_intervals_in_one_dimension_from_file( filename , dimension );
+ }
+ this->construct_persistence_landscape_from_barcode( barcode );
+ this->set_up_numbers_of_functions_for_vectorization_and_projections_to_reals();
}
diff --git a/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape_on_grid.h b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape_on_grid.h
index 02a80435..1f4cb3ff 100644
--- a/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape_on_grid.h
+++ b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape_on_grid.h
@@ -33,6 +33,7 @@
#include <algorithm>
#include <unistd.h>
#include <cmath>
+#include <limits>
//gudhi include
@@ -84,14 +85,14 @@ public:
* to be empty. Even if the points within a line are not ordered, they will be ordered while the input is read. The additional parameters of this procedure are: ranges of grid, resoltion of a grid
* number of landscape functions to be created and the dimension of intervals that are need to be read from a file (in case of Gudhi format files).
**/
- Persistence_landscape_on_grid(const char* filename , double grid_min_, double grid_max_ , size_t number_of_points_ , unsigned number_of_levels_of_landscape , size_t dimension_ = 0 );
+ Persistence_landscape_on_grid(const char* filename , double grid_min_, double grid_max_ , size_t number_of_points_ , unsigned number_of_levels_of_landscape , unsigned short dimension_ = std::numeric_limits<unsigned short>::max() );
/**
* Constructor that reads persistence intervals from file and creates persistence landscape. The format of the input file is the following: in each line we put birth-death pair. Last line is assumed
* to be empty. Even if the points within a line are not ordered, they will be ordered while the input is read. The additional parameters of this procedure are: ranges of grid, resoltion of a grid
* and the dimension of intervals that are need to be read from a file (in case of Gudhi format files).
**/
- Persistence_landscape_on_grid(const char* filename , double grid_min_, double grid_max_ , size_t number_of_points_ , size_t dimension_ = 0 );
+ Persistence_landscape_on_grid(const char* filename , double grid_min_, double grid_max_ , size_t number_of_points_ , unsigned short dimension_ = std::numeric_limits<unsigned short>::max() );
/**
@@ -99,14 +100,15 @@ public:
* to be empty. Even if the points within a line are not ordered, they will be ordered while the input is read. The additional parameter is the resoution of a grid and the number of landscape
* functions to be created. The remaning parameters are calculated based on data.
**/
- Persistence_landscape_on_grid(const char* filename , size_t number_of_points , unsigned number_of_levels_of_landscape );
+ Persistence_landscape_on_grid(const char* filename , size_t number_of_points , unsigned number_of_levels_of_landscape , unsigned short dimension = std::numeric_limits<unsigned short>::max() );
/**
* Constructor that reads persistence intervals from file and creates persistence landscape. The format of the input file is the following: in each line we put birth-death pair. Last line is assumed
- * to be empty. Even if the points within a line are not ordered, they will be ordered while the input is read. The additional parameter is the resoution of a grid. The remaning paraameters are
- * calculated based on data.
+ * to be empty. Even if the points within a line are not ordered, they will be ordered while the input is read. The additional parameter is the resoution of a grid. The last parameter is the dimension
+ * of a persistence to read from the file. If your file contains only persistence pair in a single dimension, please set it up to std::numeric_limits<unsigned>::max().
+ * The remaning parameters are calculated based on data.
**/
- Persistence_landscape_on_grid(const char* filename , size_t number_of_points );
+ Persistence_landscape_on_grid(const char* filename , size_t number_of_points , unsigned short dimension = std::numeric_limits<unsigned short>::max() );
/**
@@ -1256,33 +1258,45 @@ Persistence_landscape_on_grid::Persistence_landscape_on_grid( const std::vector<
}
-Persistence_landscape_on_grid::Persistence_landscape_on_grid(const char* filename , double grid_min_, double grid_max_ , size_t number_of_points_ , size_t dimension )
+Persistence_landscape_on_grid::Persistence_landscape_on_grid(const char* filename , double grid_min_, double grid_max_ , size_t number_of_points_ , unsigned short dimension )
{
- //standard file with barcode
- std::vector< std::pair< double , double > > p = read_standard_persistence_file( filename );
- //gudhi file with barcode
- //std::vector< std::pair< double , double > > p = read_gudhi_persistence_file_in_one_dimension( filename , dimension );
-
- this->set_up_values_of_landscapes( p , grid_min_ , grid_max_ , number_of_points_ );
+ std::vector< std::pair< double , double > > p;
+ if ( dimension == std::numeric_limits<unsigned short>::max() )
+ {
+ p = read_persistence_intervals_in_one_dimension_from_file( filename );
+ }
+ else
+ {
+ p = read_persistence_intervals_in_one_dimension_from_file( filename , dimension );
+ }
+ this->set_up_values_of_landscapes( p , grid_min_ , grid_max_ , number_of_points_ );
}
-Persistence_landscape_on_grid::Persistence_landscape_on_grid(const char* filename , double grid_min_, double grid_max_ , size_t number_of_points_, unsigned number_of_levels_of_landscape, size_t dimension )
+Persistence_landscape_on_grid::Persistence_landscape_on_grid(const char* filename , double grid_min_, double grid_max_ , size_t number_of_points_, unsigned number_of_levels_of_landscape, unsigned short dimension )
{
- //standard file with barcode
- std::vector< std::pair< double , double > > p = read_standard_persistence_file( filename );
- //gudhi file with barcode
- //std::vector< std::pair< double , double > > p = read_gudhi_persistence_file_in_one_dimension( filename , dimension );
-
- this->set_up_values_of_landscapes( p , grid_min_ , grid_max_ , number_of_points_ , number_of_levels_of_landscape );
+ std::vector< std::pair< double , double > > p;
+ if ( dimension == std::numeric_limits<unsigned short>::max() )
+ {
+ p = read_persistence_intervals_in_one_dimension_from_file( filename );
+ }
+ else
+ {
+ p = read_persistence_intervals_in_one_dimension_from_file( filename , dimension );
+ }
+ this->set_up_values_of_landscapes( p , grid_min_ , grid_max_ , number_of_points_ , number_of_levels_of_landscape );
}
-Persistence_landscape_on_grid::Persistence_landscape_on_grid(const char* filename , size_t number_of_points_ )
+Persistence_landscape_on_grid::Persistence_landscape_on_grid(const char* filename , size_t number_of_points_ , unsigned short dimension )
{
- //standard file with barcode
- std::vector< std::pair< double , double > > p = read_standard_persistence_file( filename );
- //gudhi file with barcode
- //std::vector< std::pair< double , double > > p = read_gudhi_persistence_file_in_one_dimension( filename , dimension );
-
+ std::vector< std::pair< double , double > > p;
+ if ( dimension == std::numeric_limits<unsigned short>::max() )
+ {
+ p = read_persistence_intervals_in_one_dimension_from_file( filename );
+ }
+ else
+ {
+ p = read_persistence_intervals_in_one_dimension_from_file( filename , dimension );
+ }
double grid_min_ = std::numeric_limits<double>::max();
double grid_max_ = -std::numeric_limits<double>::max();
for ( size_t i = 0 ; i != p.size() ; ++i )
@@ -1293,13 +1307,17 @@ Persistence_landscape_on_grid::Persistence_landscape_on_grid(const char* filenam
this->set_up_values_of_landscapes( p , grid_min_ , grid_max_ , number_of_points_ );
}
-Persistence_landscape_on_grid::Persistence_landscape_on_grid(const char* filename , size_t number_of_points_ , unsigned number_of_levels_of_landscape )
+Persistence_landscape_on_grid::Persistence_landscape_on_grid(const char* filename , size_t number_of_points_ , unsigned number_of_levels_of_landscape , unsigned short dimension )
{
- //standard file with barcode
- std::vector< std::pair< double , double > > p = read_standard_persistence_file( filename );
- //gudhi file with barcode
- //std::vector< std::pair< double , double > > p = read_gudhi_persistence_file_in_one_dimension( filename , dimension );
-
+ std::vector< std::pair< double , double > > p;
+ if ( dimension == std::numeric_limits<unsigned short>::max() )
+ {
+ p = read_persistence_intervals_in_one_dimension_from_file( filename );
+ }
+ else
+ {
+ p = read_persistence_intervals_in_one_dimension_from_file( filename , dimension );
+ }
double grid_min_ = std::numeric_limits<double>::max();
double grid_max_ = -std::numeric_limits<double>::max();
for ( size_t i = 0 ; i != p.size() ; ++i )
diff --git a/src/Gudhi_stat/include/gudhi/persistence_representations/persistence_vectors.h b/src/Gudhi_stat/include/gudhi/persistence_representations/persistence_vectors.h
index b1a3e4fd..aa1f23c2 100644
--- a/src/Gudhi_stat/include/gudhi/persistence_representations/persistence_vectors.h
+++ b/src/Gudhi_stat/include/gudhi/persistence_representations/persistence_vectors.h
@@ -105,7 +105,7 @@ public:
/**
* The constructor taking as an input a file with birth-death pairs. The second parameter is the desiered length of the output vectors.
**/
- Vector_distances_in_diagram( const char* filename , size_t where_to_cut );
+ Vector_distances_in_diagram( const char* filename , size_t where_to_cut , unsigned dimension = std::numeric_limits<unsigned>::max() );
/**
@@ -432,13 +432,17 @@ Vector_distances_in_diagram<F>::Vector_distances_in_diagram( const std::vector<
}
template <typename F>
-Vector_distances_in_diagram<F>::Vector_distances_in_diagram( const char* filename , size_t where_to_cut ):where_to_cut(where_to_cut)
-{
- //standard file with barcode
- std::vector< std::pair< double , double > > intervals = read_standard_persistence_file( filename );
- //gudhi file with barcode
- //std::vector< std::pair< double , double > > intervals = read_gudhi_persistence_file( filename , dimension );
-
+Vector_distances_in_diagram<F>::Vector_distances_in_diagram( const char* filename , size_t where_to_cut , unsigned dimension ):where_to_cut(where_to_cut)
+{
+ std::vector< std::pair< double , double > > intervals;
+ if ( dimension == std::numeric_limits<unsigned>::max() )
+ {
+ intervals = read_persistence_intervals_in_one_dimension_from_file( filename );
+ }
+ else
+ {
+ intervals = read_persistence_intervals_in_one_dimension_from_file( filename , dimension );
+ }
this->intervals = intervals;
this->compute_sorted_vector_of_distances_via_heap( where_to_cut );
//this->compute_sorted_vector_of_distances_via_vector_sorting( where_to_cut );
diff --git a/src/Gudhi_stat/include/gudhi/topological_process.h b/src/Gudhi_stat/include/gudhi/topological_process.h
index 17bea5ab..03edbb85 100644
--- a/src/Gudhi_stat/include/gudhi/topological_process.h
+++ b/src/Gudhi_stat/include/gudhi/topological_process.h
@@ -39,6 +39,9 @@ namespace Gudhi
{
namespace Gudhi_stat
{
+
+
+//TODO, change reading procedures so that they also accept the value of dimension.
//over here we will need a few version of construct_representation_from_file procedure, since different representations may require different parameters. This is a procedure that in my
//oppinion cannot be standarize, since construction of representation cannot. But, the remaining part of the code in my opinion is free from any details of representation.
@@ -62,7 +65,7 @@ std::vector< std::vector< std::pair< double , double > > > read_persistence_pair
for ( size_t i = 0 ; i != files.size() ; ++i )
{
- std::vector< std::pair< double , double > > diag = read_standard_persistence_file( files[i].c_str() );
+ std::vector< std::pair< double , double > > diag = read_persistence_intervals_in_one_dimension_from_file( files[i].c_str() );
result.push_back( diag );
if ( dbg )
{
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 ae771149..54fb2b84 100644
--- a/src/Gudhi_stat/test/persistence_lanscapes_on_grid_test.cpp
+++ b/src/Gudhi_stat/test/persistence_lanscapes_on_grid_test.cpp
@@ -44,7 +44,7 @@ double epsilon = 0.0000005;
BOOST_AUTO_TEST_CASE(check_construction_of_landscape)
{
- Persistence_landscape_on_grid l( "data/file_with_diagram_1" , 100 );
+ Persistence_landscape_on_grid l( "data/file_with_diagram_1" , 100 , std::numeric_limits<unsigned short>::max());
l.print_to_file( "landscape_from_file_with_diagram_1" );
Persistence_landscape_on_grid g;
@@ -57,8 +57,8 @@ BOOST_AUTO_TEST_CASE(check_construction_of_landscape_using_only_ten_levels)
{
//TODO
unsigned number = 10;
- Persistence_landscape_on_grid l( "data/file_with_diagram_1" , 100 ,number );
- Persistence_landscape_on_grid g( "data/file_with_diagram_1" , 100 );
+ Persistence_landscape_on_grid l( "data/file_with_diagram_1" , 100 , number );
+ Persistence_landscape_on_grid g( "data/file_with_diagram_1" , 100 , std::numeric_limits<unsigned short>::max());
//cut all the elements of order > 10 in g.
for ( size_t level = 0 ; level != number ; ++level )
@@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE(check_construction_of_landscape_using_only_ten_levels)
BOOST_AUTO_TEST_CASE(check_computations_of_integrals)
{
- Persistence_landscape_on_grid p( "data/file_with_diagram_1" , 100 );
+ Persistence_landscape_on_grid p( "data/file_with_diagram_1" , 100 , std::numeric_limits<unsigned short>::max());
double integral = p.compute_integral_of_landscape();
//cerr << "integral : " << integral << endl;getchar();
BOOST_CHECK( fabs( integral - 27.343 ) <= 0.00005 );
@@ -86,7 +86,7 @@ BOOST_AUTO_TEST_CASE(check_computations_of_integrals)
BOOST_AUTO_TEST_CASE(check_computations_of_integrals_for_each_level_separatelly)
{
- Persistence_landscape_on_grid p( "data/file_with_diagram_1" , 100 );
+ Persistence_landscape_on_grid p( "data/file_with_diagram_1" , 100, std::numeric_limits<unsigned short>::max() );
std::vector< double > integrals_fir_different_levels;
//integrals_fir_different_levels.push_back();
@@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE(check_computations_of_integrals_for_each_level_separatelly)
BOOST_AUTO_TEST_CASE(check_computations_of_integrals_of_powers_of_landscape)
{
- Persistence_landscape_on_grid p( "data/file_with_diagram_1" , 100 );
+ Persistence_landscape_on_grid p( "data/file_with_diagram_1" , 100, std::numeric_limits<unsigned short>::max() );
std::vector<double> integrals_fir_different_powers;
integrals_fir_different_powers.push_back( 0.241168);
@@ -145,7 +145,7 @@ BOOST_AUTO_TEST_CASE(check_computations_of_integrals_of_powers_of_landscape)
BOOST_AUTO_TEST_CASE(check_computations_of_values_on_different_points)
{
- Persistence_landscape_on_grid p( "data/file_with_diagram_1" , 100 );
+ Persistence_landscape_on_grid p( "data/file_with_diagram_1" , 100, std::numeric_limits<unsigned short>::max() );
std::vector< double > results_level_0;
results_level_0.push_back(0.00997867);
@@ -184,8 +184,8 @@ BOOST_AUTO_TEST_CASE(check_computations_of_values_on_different_points)
BOOST_AUTO_TEST_CASE(check_computations_sum_differences_and_multiplications)
{
- Persistence_landscape_on_grid p( "data/file_with_diagram_1" ,100 );
- Persistence_landscape_on_grid second("data/file_with_diagram_1" , 100 );
+ Persistence_landscape_on_grid p( "data/file_with_diagram_1" ,100 , std::numeric_limits<unsigned short>::max());
+ Persistence_landscape_on_grid second("data/file_with_diagram_1" , 100, std::numeric_limits<unsigned short>::max() );
Persistence_landscape_on_grid sum = p + second;
Persistence_landscape_on_grid difference = p - second;
@@ -210,8 +210,8 @@ BOOST_AUTO_TEST_CASE(check_computations_sum_differences_and_multiplications)
BOOST_AUTO_TEST_CASE(check_computations_of_maxima_and_norms)
{
- Persistence_landscape_on_grid p( "data/file_with_diagram_1" , 0 , 1 , 100 );
- Persistence_landscape_on_grid second("data/file_with_diagram_2" , 0 , 1 , 100 );
+ Persistence_landscape_on_grid p( "data/file_with_diagram_1" , 0. , 1. , 100 );
+ Persistence_landscape_on_grid second("data/file_with_diagram_2" , 0. , 1. , 100 );
Persistence_landscape_on_grid sum = p + second;
//cerr << p.compute_maximum() << endl;
@@ -236,8 +236,8 @@ BOOST_AUTO_TEST_CASE(check_computations_of_maxima_and_norms)
BOOST_AUTO_TEST_CASE(check_computations_of_averages)
{
- Persistence_landscape_on_grid p( "data/file_with_diagram", 0,1,100 );
- Persistence_landscape_on_grid q( "data/file_with_diagram_1", 0,1,100 );
+ Persistence_landscape_on_grid p( "data/file_with_diagram", 0.,1.,100 );
+ Persistence_landscape_on_grid q( "data/file_with_diagram_1", 0.,1.,100 );
Persistence_landscape_on_grid av;
av.compute_average( {&p,&q} );
@@ -251,8 +251,8 @@ BOOST_AUTO_TEST_CASE(check_computations_of_averages)
BOOST_AUTO_TEST_CASE(check_computations_of_distances)
{
- Persistence_landscape_on_grid p( "data/file_with_diagram", 0,1,10000 );
- Persistence_landscape_on_grid q( "data/file_with_diagram_1", 0,1,10000 );
+ Persistence_landscape_on_grid p( "data/file_with_diagram", 0.,1.,10000 );
+ Persistence_landscape_on_grid q( "data/file_with_diagram_1", 0.,1.,10000 );
BOOST_CHECK( fabs( p.distance( q )- 25.5779) <= 0.00005 );
BOOST_CHECK( fabs( p.distance( q , 2) - 2.04891) <= 0.00001 );
BOOST_CHECK( fabs( p.distance( q , std::numeric_limits<double>::max() )-0.359 ) <= 0.00001 );
@@ -261,8 +261,8 @@ BOOST_AUTO_TEST_CASE(check_computations_of_distances)
BOOST_AUTO_TEST_CASE(check_computations_of_scalar_product)
{
- Persistence_landscape_on_grid p( "data/file_with_diagram" , 0,1,10000);
- Persistence_landscape_on_grid q( "data/file_with_diagram_1", 0,1,10000 );
+ Persistence_landscape_on_grid p( "data/file_with_diagram" , 0.,1.,10000);
+ Persistence_landscape_on_grid q( "data/file_with_diagram_1", 0.,1.,10000 );
//std::cerr << p.compute_scalar_product( q ) << std::endl;
BOOST_CHECK( almost_equal( p.compute_scalar_product( q ) , 0.754367 ) );
}
@@ -375,3 +375,4 @@ BOOST_AUTO_TEST_CASE(check_computations_of_scalar_product)
//Persistence_landscape_on_grid q( aa, 0,1,10 );
cerr << p.compute_scalar_product( &q ) << endl;
*/
+
diff --git a/src/Gudhi_stat/utilities/Multiplicative_bootstrap.cpp b/src/Gudhi_stat/utilities/Multiplicative_bootstrap.cpp
index 42534752..7ee389f8 100644
--- a/src/Gudhi_stat/utilities/Multiplicative_bootstrap.cpp
+++ b/src/Gudhi_stat/utilities/Multiplicative_bootstrap.cpp
@@ -51,7 +51,7 @@ int main( int argc , char** argv )
std::vector< Persistence_landscape* > collection_of_landscapes( filenames.size() );
for ( size_t i = 0 ; i != filenames.size() ; ++i )
{
- std::vector< std::pair< double , double > > diag = read_gudhi_persistence_file_in_one_dimension( filenames[i].c_str() , 1 );//read_standard_persistence_file( filenames[i].c_str() );
+ std::vector< std::pair< double , double > > diag = read_persistence_intervals_in_one_dimension_from_file( filenames[i].c_str() );
collection_of_landscapes[i] = new Persistence_landscape( diag );
}
diff --git a/src/Gudhi_stat/utilities/permutation_test.cpp b/src/Gudhi_stat/utilities/permutation_test.cpp
index e431026f..62cd3f10 100644
--- a/src/Gudhi_stat/utilities/permutation_test.cpp
+++ b/src/Gudhi_stat/utilities/permutation_test.cpp
@@ -62,7 +62,7 @@ int main( int argc , char** argv )
std::vector< Persistence_landscape* > first_collection( first_group.size() );
for ( size_t i = 0 ; i != first_group.size() ; ++i )
{
- std::vector< std::pair< double , double > > diag = read_standard_persistence_file( first_group[i].c_str() );
+ std::vector< std::pair< double , double > > diag = read_persistence_intervals_in_one_dimension_from_file( first_group[i].c_str() );
Persistence_landscape* l = new Persistence_landscape( diag );
first_collection[i] = l;
}
diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp
index 5d2100aa..d9c7aded 100644
--- a/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp
@@ -40,26 +40,32 @@ int main( int argc , char** argv )
std::cout << "The first parameter of a program is an integer, a size of a grid.\n";
std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n";
std::cerr << "The fourth parameter is an integer, the standard deviation of a gaussian kernel expressed in a number of pixels \n";
- std::cout << "The remaining parameters are the names of files with persistence diagrams. \n";
+ std::cout << "The fifth parameter of this program is a dimension of persistence that will be used in creation of the persistence heat maps.";
+ std::cout << "If our input files contain persistence pairs of various dimension, as a fifth parameter of the procedure please provide the dimension of persistence you want to use.";
+ std::cout << "If in your file there are only birth-death pairs of the same dimension, set the first parameter to -1." << std::endl;
+ std::cout << "The remaining parameters are the names of files with persistence diagrams. \n";
if ( argc < 5 )
{
std::cout << "Wrong parameter list, the program will now terminate \n";
return 1;
- }
-
+ }
size_t size_of_grid = (size_t)atoi( argv[1] );
double min_ = atof( argv[2] );
double max_ = atof( argv[3] );
size_t stdiv = atof( argv[4] );
+ unsigned dimension = std::numeric_limits<unsigned>::max();
+ int dim = atoi( argv[5] );
+ if ( (dim != -1) && (dim >= 0) )
+ {
+ dimension = (unsigned)dim;
+ }
std::vector< const char* > filenames;
- for ( int i = 5 ; i < argc ; ++i )
+ for ( int i = 6 ; i < argc ; ++i )
{
filenames.push_back( argv[i] );
}
-
-
std::cout << "Creating persistence heat maps...\n";
std::vector< std::vector<double> > filter = create_Gaussian_filter(stdiv,1);
@@ -67,7 +73,7 @@ int main( int argc , char** argv )
for ( size_t i = 0 ; i != filenames.size() ; ++i )
{
std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl;
- Persistence_heat_maps<constant_scaling_function> l( filenames[i] , filter, false , size_of_grid , min_ , max_ );
+ Persistence_heat_maps<constant_scaling_function> l( filenames[i] , filter, false , size_of_grid , min_ , max_ , dimension );
std::stringstream ss;
ss << filenames[i] << ".mps";
diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp
index 8496e33e..7cb7eeb7 100644
--- a/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp
@@ -1,4 +1,4 @@
-/* This file is part of the Gudhi Library. The Gudhi library
+ /* This file is part of the Gudhi Library. The Gudhi library
* (Geometric Understanding in Higher Dimensions) is a generic C++
* library for computational topology.
*
@@ -40,8 +40,11 @@ int main( int argc , char** argv )
std::cout << "The first parameter of a program is an integer, a size of a grid.\n";
std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n";
std::cerr << "The fourth parameter is an integer, the standard deviation of a gaussian kernel expressed in a number of pixels \n";
+ std::cout << "The fifth parameter of this program is a dimension of persistence that will be used in creation of the persistence heat maps.";
+ std::cout << "If our input files contain persistence pairs of various dimension, as a fifth parameter of the procedure please provide the dimension of persistence you want to use.";
+ std::cout << "If in your file there are only birth-death pairs of the same dimension, set the first parameter to -1." << std::endl;
std::cout << "The remaining parameters are the names of files with persistence diagrams. \n";
-
+
if ( argc < 5 )
{
std::cout << "Wrong parameter list, the program will now terminate \n";
@@ -53,8 +56,15 @@ int main( int argc , char** argv )
double max_ = atof( argv[3] );
size_t stdiv = atof( argv[4] );
+ unsigned dimension = std::numeric_limits<unsigned>::max();
+ int dim = atoi( argv[5] );
+ if ( (dim != -1) && (dim >= 0) )
+ {
+ dimension = (unsigned)dim;
+ }
+
std::vector< const char* > filenames;
- for ( int i = 5 ; i < argc ; ++i )
+ for ( int i = 6 ; i < argc ; ++i )
{
filenames.push_back( argv[i] );
}
@@ -67,7 +77,7 @@ int main( int argc , char** argv )
for ( size_t i = 0 ; i != filenames.size() ; ++i )
{
std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl;
- Persistence_heat_maps<arc_tan_of_persistence_of_point> l( filenames[i] , filter, false , size_of_grid , min_ , max_ );
+ Persistence_heat_maps<arc_tan_of_persistence_of_point> l( filenames[i] , filter, false , size_of_grid , min_ , max_ , dimension );
std::stringstream ss;
ss << filenames[i] << ".mps";
diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp
index 83d4f3bc..3242e106 100644
--- a/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp
@@ -39,6 +39,9 @@ int main( int argc , char** argv )
std::cout << "The first parameter of a program is an integer, a size of a grid.\n";
std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n";
std::cerr << "The fourth parameter is an integer, the standard deviation of a gaussian kernel expressed in a number of pixels \n";
+ std::cout << "The fifth parameter of this program is a dimension of persistence that will be used in creation of the persistence heat maps.";
+ std::cout << "If our input files contain persistence pairs of various dimension, as a fifth parameter of the procedure please provide the dimension of persistence you want to use.";
+ std::cout << "If in your file there are only birth-death pairs of the same dimension, set the first parameter to -1." << std::endl;
std::cout << "The remaining parameters are the names of files with persistence diagrams. \n";
if ( argc < 5 )
@@ -52,8 +55,15 @@ int main( int argc , char** argv )
double max_ = atof( argv[3] );
size_t stdiv = atof( argv[4] );
+ unsigned dimension = std::numeric_limits<unsigned>::max();
+ int dim = atoi( argv[5] );
+ if ( (dim != -1) && (dim >= 0) )
+ {
+ dimension = (unsigned)dim;
+ }
+
std::vector< const char* > filenames;
- for ( int i = 5 ; i < argc ; ++i )
+ for ( int i = 6 ; i < argc ; ++i )
{
filenames.push_back( argv[i] );
}
@@ -66,7 +76,7 @@ int main( int argc , char** argv )
for ( size_t i = 0 ; i != filenames.size() ; ++i )
{
std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl;
- Persistence_heat_maps<distance_from_diagonal_scaling> l( filenames[i] , filter , size_of_grid , min_ , max_ );
+ Persistence_heat_maps<distance_from_diagonal_scaling> l( filenames[i] , filter , size_of_grid , min_ , max_ , dimension );
std::stringstream ss;
ss << filenames[i] << ".mps";
diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp
index f62615f5..27846a99 100644
--- a/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp
@@ -39,8 +39,11 @@ int main( int argc , char** argv )
std::cout << "The first parameter of a program is an integer, a size of a grid.\n";
std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n";
std::cerr << "The fourth parameter is an integer, the standard deviation of a gaussian kernel expressed in a number of pixels \n";
+ std::cout << "The fifth parameter of this program is a dimension of persistence that will be used in creation of the persistence heat maps.";
+ std::cout << "If our input files contain persistence pairs of various dimension, as a fifth parameter of the procedure please provide the dimension of persistence you want to use.";
+ std::cout << "If in your file there are only birth-death pairs of the same dimension, set the first parameter to -1." << std::endl;
std::cout << "The remaining parameters are the names of files with persistence diagrams. \n";
-
+
if ( argc < 5 )
{
std::cout << "Wrong parameter list, the program will now terminate \n";
@@ -51,14 +54,19 @@ int main( int argc , char** argv )
double min_ = atof( argv[2] );
double max_ = atof( argv[3] );
size_t stdiv = atof( argv[4] );
+
+ unsigned dimension = std::numeric_limits<unsigned>::max();
+ int dim = atoi( argv[5] );
+ if ( (dim != -1) && (dim >= 0) )
+ {
+ dimension = (unsigned)dim;
+ }
std::vector< const char* > filenames;
- for ( int i = 5 ; i < argc ; ++i )
+ for ( int i = 6 ; i < argc ; ++i )
{
filenames.push_back( argv[i] );
}
-
-
std::cout << "Creating persistence heat maps...\n";
std::vector< std::vector<double> > filter = create_Gaussian_filter(stdiv,1);
@@ -66,7 +74,7 @@ int main( int argc , char** argv )
for ( size_t i = 0 ; i != filenames.size() ; ++i )
{
std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl;
- Persistence_heat_maps<squared_distance_from_diagonal_scaling> l( filenames[i] , filter, false , size_of_grid , min_ , max_ );
+ Persistence_heat_maps<squared_distance_from_diagonal_scaling> l( filenames[i] , filter, false , size_of_grid , min_ , max_ , dimension );
std::stringstream ss;
ss << filenames[i] << ".mps";
diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/create_pssk.cpp b/src/Gudhi_stat/utilities/persistence_heat_maps/create_pssk.cpp
index d38bb8b9..404a4be3 100644
--- a/src/Gudhi_stat/utilities/persistence_heat_maps/create_pssk.cpp
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/create_pssk.cpp
@@ -38,8 +38,12 @@ int main( int argc , char** argv )
std::cout << "The first parameter of a program is an integer, a size of a grid.\n";
std::cout << "The second and third parameters are min and max of the grid. If you want those numbers to be computed based on the data, set them both to -1 \n";
std::cerr << "The fourth parameter is an integer, the standard deviation of a gaussian kernel expressed in a number of pixels \n";
+ std::cerr << "The fourth parameter is an integer, the standard deviation of a gaussian kernel expressed in a number of pixels \n";
+ std::cout << "The fifth parameter of this program is a dimension of persistence that will be used in creation of the persistence heat maps.";
+ std::cout << "If our input files contain persistence pairs of various dimension, as a fifth parameter of the procedure please provide the dimension of persistence you want to use.";
+ std::cout << "If in your file there are only birth-death pairs of the same dimension, set the first parameter to -1." << std::endl;
std::cout << "The remaining parameters are the names of files with persistence diagrams. \n";
-
+
if ( argc < 5 )
{
std::cout << "Wrong parameter list, the program will now terminate \n";
@@ -51,8 +55,15 @@ int main( int argc , char** argv )
double max_ = atof( argv[3] );
size_t stdiv = atof( argv[4] );
+ unsigned dimension = std::numeric_limits<unsigned>::max();
+ int dim = atoi( argv[5] );
+ if ( (dim != -1) && (dim >= 0) )
+ {
+ dimension = (unsigned)dim;
+ }
+
std::vector< const char* > filenames;
- for ( int i = 5 ; i < argc ; ++i )
+ for ( int i = 6 ; i < argc ; ++i )
{
filenames.push_back( argv[i] );
}
@@ -63,7 +74,7 @@ int main( int argc , char** argv )
for ( size_t i = 0 ; i != filenames.size() ; ++i )
{
std::cout << "Creating a heat map based on a file : " << filenames[i] << std::endl;
- PSSK l( filenames[i] , filter , size_of_grid , min_ , max_ );
+ PSSK l( filenames[i] , filter , size_of_grid , min_ , max_ , dimension );
std::stringstream ss;
ss << filenames[i] << ".pssk";
diff --git a/src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt b/src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt
index 96cb1a5e..9420a8ea 100644
--- a/src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt
+++ b/src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt
@@ -1,8 +1,6 @@
cmake_minimum_required(VERSION 2.6)
project(GUDHI_STAT)
-
-
#persitence diagrams
add_executable ( plot_persistence_intervals plot_persistence_intervals.cpp )
target_link_libraries( plot_persistence_intervals ${Boost_SYSTEM_LIBRARY})
@@ -16,7 +14,14 @@ target_link_libraries( compute_number_of_dominant_intervals ${Boost_SYSTEM_LIBRA
add_executable ( plot_histogram_of_intervals_lengths plot_histogram_of_intervals_lengths.cpp )
target_link_libraries( plot_histogram_of_intervals_lengths ${Boost_SYSTEM_LIBRARY})
-add_executable ( plot_persistence_Betti_numebrs plot_persistence_Betti_numebrs.cpp )
-target_link_libraries( plot_persistence_Betti_numebrs ${Boost_SYSTEM_LIBRARY})
+add_executable ( plot_persistence_Betti_numbers plot_persistence_Betti_numbers.cpp )
+target_link_libraries( plot_persistence_Betti_numbers ${Boost_SYSTEM_LIBRARY})
+
+if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
+add_executable ( compute_bottleneck_distance compute_bottleneck_distance.cpp )
+target_link_libraries( compute_bottleneck_distance ${Boost_SYSTEM_LIBRARY})
+if (TBB_FOUND)
+target_link_libraries(compute_bottleneck_distance ${TBB_LIBRARIES})
+endif(TBB_FOUND)
-#when we have bottleneck and wasserstein distance computations, add suitable programs here.
+endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
diff --git a/src/Gudhi_stat/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp b/src/Gudhi_stat/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp
index 145040fe..426a9b7b 100644
--- a/src/Gudhi_stat/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp
+++ b/src/Gudhi_stat/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp
@@ -37,18 +37,20 @@ using namespace Gudhi::Gudhi_stat;
int main( int argc , char** argv )
{
- //std::cout << "This program compute minimum birth and the maximum death time for a collection of persistence intervals \n";
- //if ( argc != 2 )
- //{
- // std::cout << "To run this program, please provide the name of a file with persistence diagram \n";
- // return 1;
- //}
- //Persistence_intervals p( argv[1] );
- //std::pair<double,double> min_max_ = p.min_max();
- //std::cout << "Birth-death range : min: " << min_max_.first << ", max: " << min_max_.second << endl;
+ std::cout << "This program compute the range of birth and death times of persistence pairs in diagrams provided as an input. \n";
+ std::cout << "The first parameter of the program is the dimension of persistence to be used. If your file contains ";
+ std::cout << "the information about dimension of persistence pairs, please provide here the dimension of persistence pairs you want to use. If your input files consist only ";
+ std::cout << "of birth-death pairs, please set this first parameter to -1 \n";
+ std::cout << "The remaining parameters of the program are the names of files with persistence diagrams. \n";
+ int dim = atoi( argv[1] );
+ unsigned dimension = std::numeric_limits<unsigned>::max();
+ if ( (dim != -1) && (dim >= 0) )
+ {
+ dimension = (unsigned)dim;
+ }
std::vector< const char* > filenames;
- for ( int i = 1 ; i < argc ; ++i )
+ for ( int i = 2 ; i < argc ; ++i )
{
filenames.push_back( argv[i] );
}
@@ -59,7 +61,7 @@ int main( int argc , char** argv )
for ( size_t file_no = 0 ; file_no != filenames.size() ; ++file_no )
{
std::cout << "Creating diagram based on a file : " << filenames[file_no] << std::endl;
- Persistence_intervals p( filenames[file_no] );
+ Persistence_intervals p( filenames[file_no] , dimension );
std::pair<double,double> min_max_ = p.min_max();
if ( min_max_.first < min_ )min_ = min_max_.first;
if ( min_max_.second > max_ )max_ = min_max_.second;
diff --git a/src/Gudhi_stat/utilities/persistence_intervals/compute_bottleneck_distance.cpp b/src/Gudhi_stat/utilities/persistence_intervals/compute_bottleneck_distance.cpp
new file mode 100644
index 00000000..6f0ba635
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_intervals/compute_bottleneck_distance.cpp
@@ -0,0 +1,115 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Pawel Dlotko
+ *
+ * Copyright (C) 2015 INRIA (France)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gudhi/persistence_representations/Persistence_intervals_with_distances.h>
+#include <gudhi/read_persistence_from_file.h>
+
+
+
+using namespace Gudhi;
+using namespace Gudhi::Gudhi_stat;
+
+#include <iostream>
+#include <sstream>
+
+
+int main( int argc , char** argv )
+{
+ std::cout << "This program compute the bottleneck distance of persistence diarams stored in a files. \n";
+ std::cout << "The first parameter of the program is the dimension of persistence to be used to construct persistence landscapes. If your file contains ";
+ std::cout << "the information about dimension of persistence pairs, please provide here the dimension of persistence pairs you want to use. If your input files consist only ";
+ std::cout << "of birth-death pairs, please set this first parameter to -1 \n";
+ std::cout << "The remaining parameters of this programs are names of files with persistence diagrams.\n";
+
+ if ( argc < 3 )
+ {
+ std::cout << "Wrong number of parameters, the program will now terminate \n";
+ return 1;
+ }
+
+ int dim = atoi(argv[1]);
+ unsigned dimension = std::numeric_limits<unsigned>::max();
+ if ( (dim != -1) && (dim >= 0) )
+ {
+ dimension = (unsigned)dim;
+ }
+
+
+ std::vector< const char* > filenames;
+ for ( int i = 2 ; i < argc ; ++i )
+ {
+ filenames.push_back( argv[i] );
+ }
+
+ //reading the persistence intervals:
+ std::vector< Persistence_intervals_with_distances > persistence_intervals;
+ for ( size_t i = 0 ; i != filenames.size() ; ++i )
+ {
+ Persistence_intervals_with_distances pers(filenames[i] , dimension );
+ std::cerr << "perss : " << pers << std::endl;
+ getchar();
+ persistence_intervals.push_back( pers );
+ }
+
+ //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 != persistence_intervals.size() ; ++i )
+ {
+ for ( size_t j = i+1 ; j != persistence_intervals.size() ; ++j )
+ {
+ distance[i][j] = distance[j][i] = persistence_intervals[i].distance( persistence_intervals[j] );
+ }
+ }
+
+ //and now output the result to the screen and a file:
+ std::ofstream out;
+ out.open( "distance" );
+ for ( size_t i = 0 ; i != distance.size() ; ++i )
+ {
+ for ( size_t j = 0 ; j != distance.size() ; ++j )
+ {
+ std::cout << distance[i][j] << " ";
+ out << distance[i][j] << " ";
+ }
+ std::cout << std::endl;
+ out << std::endl;
+ }
+ out.close();
+
+ return 0;
+}
+
+
+
+
+
+
+
diff --git a/src/Gudhi_stat/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp b/src/Gudhi_stat/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp
index eeda703a..0a7f7c2b 100644
--- a/src/Gudhi_stat/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp
+++ b/src/Gudhi_stat/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp
@@ -36,14 +36,19 @@ using namespace Gudhi::Gudhi_stat;
int main( int argc , char** argv )
{
std::cout << "This program compute the dominant intervals. A number of intervals to be displayed is a parameter of this program. \n";
- if ( argc != 3 )
+ if ( argc != 4 )
{
- std::cout << "To run this program, please provide the name of a file with persistence diagram and number of dominant intervals you would like to get \n";
+ std::cout << "To run this program, please provide the name of a file with persistence diagram, dimension of intervals that should be taken into account (if your file contains only persistence pairs in a single dimension, set it up to -1) 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] ) );
+ int dim = atoi( argv[2] );
+ unsigned dimension = std::numeric_limits<unsigned>::max();
+ if ( (dim != -1) && (dim >= 0) )
+ {
+ dimension = (unsigned)dim;
+ }
+ Persistence_intervals p( argv[1] , dimension );
+ std::vector< std::pair<double,double> > dominant_intervals = p.dominant_intervals( atoi( argv[3] ) );
std::cout << "Here are the dominant intervals : " << std::endl;
for ( size_t i = 0 ; i != dominant_intervals.size() ; ++i )
{
diff --git a/src/Gudhi_stat/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp b/src/Gudhi_stat/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp
index db9c3f98..11876a0d 100644
--- a/src/Gudhi_stat/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp
+++ b/src/Gudhi_stat/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp
@@ -39,10 +39,21 @@ int main( int argc , char** argv )
if ( argc != 3 )
{
std::cout << "To run this program, please provide the name of a file with persistence diagram and number of dominant intervals you would like to get \n";
+ std::cout << "The second parameter of a program is the dimension of the persistence that is to be used. If your file contains only birth-death pairs, you can skip this parameter\n";
return 1;
}
+ unsigned dimension = std::numeric_limits<unsigned>::max();
+ int dim = -1;
+ if ( argc > 2 )
+ {
+ dim = atoi( argv[2] );
+ }
+ if ( (dim != -1) && (dim >= 0) )
+ {
+ dimension = (unsigned)dim;
+ }
- Persistence_intervals p( argv[1] );
+ Persistence_intervals p( argv[1] , dimension );
std::vector< std::pair<double,double> > dominant_intervals = p.dominant_intervals( atoi( argv[2] ) );
std::vector< size_t > histogram = p.histogram_of_lengths( 10 );
diff --git a/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp b/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_Betti_numbers.cpp
index cb89f6b9..09c6cc22 100644
--- a/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_Betti_numebrs.cpp
+++ b/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_Betti_numbers.cpp
@@ -36,12 +36,22 @@ using namespace Gudhi::Gudhi_stat;
int main( int argc , char** argv )
{
std::cout << "This program compute a plot of persistence Betti numbers. The input parameter is a file with persistence intervals. \n";
- if ( argc != 2 )
+ std::cout << "The second optional parameter of a program is the dimension of the persistence that is to be used. If your file contains only birth-death pairs, you can skip this parameter\n";
+ if ( argc < 2 )
{
std::cout << "To run this program, please provide the name of a file with persistence diagram and number of dominant intervals you would like to get \n";
return 1;
}
-
+ unsigned dimension = std::numeric_limits<unsigned>::max();
+ int dim = -1;
+ if ( argc > 2 )
+ {
+ dim = atoi( argv[2] );
+ }
+ if ( (dim != -1) && (dim >= 0) )
+ {
+ dimension = (unsigned)dim;
+ }
std::stringstream gnuplot_script;
@@ -49,7 +59,7 @@ int main( int argc , char** argv )
std::ofstream out;
out.open( gnuplot_script.str().c_str() );
- Persistence_intervals p( argv[1] );
+ Persistence_intervals p( argv[1] , dimension );
std::vector< std::pair< double , size_t > > pbns = p.compute_persistent_betti_numbers();
//set up the ranges so that we see the image well.
diff --git a/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_intervals.cpp b/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_intervals.cpp
index bc466bd3..4315abb9 100644
--- a/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_intervals.cpp
+++ b/src/Gudhi_stat/utilities/persistence_intervals/plot_persistence_intervals.cpp
@@ -42,9 +42,23 @@ int main( int argc , char** argv )
if ( argc != 2 )
{
std::cout << "To run this program, please provide the name of a file with persistence diagram \n";
+ std::cout << "The second optional parameter of a program is the dimension of the persistence that is to be used. If your file contains only birth-death pairs, you can skip this parameter\n";
return 1;
}
- std::vector< std::pair< double , double > > intervals = read_gudhi_persistence_file_in_one_dimension( argv[1] , 2 );
+ unsigned dimension = std::numeric_limits<unsigned>::max();
+ int dim = -1;
+ if ( argc > 2 )
+ {
+ dim = atoi( argv[2] );
+ }
+ if ( (dim != -1) && (dim >= 0) )
+ {
+ dimension = (unsigned)dim;
+ }
+
+
+
+ std::vector< std::pair< double , double > > intervals = read_persistence_intervals_in_one_dimension_from_file( argv[1] , dimension );
Persistence_intervals b( intervals );
b.plot( argv[1] );
return 0;
diff --git a/src/Gudhi_stat/utilities/persistence_landscapes/create_landscapes.cpp b/src/Gudhi_stat/utilities/persistence_landscapes/create_landscapes.cpp
index 5485bf2a..f36e313a 100644
--- a/src/Gudhi_stat/utilities/persistence_landscapes/create_landscapes.cpp
+++ b/src/Gudhi_stat/utilities/persistence_landscapes/create_landscapes.cpp
@@ -32,9 +32,19 @@ using namespace Gudhi::Gudhi_stat;
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::cout << "This program creates persistence landscapes of diagrams provided as an input. \n";
+ std::cout << "The first parameter of the program is the dimension of persistence to be used to construct persistence landscapes. If your file contains ";
+ std::cout << "the information about dimension of persistence pairs, please provide here the dimension of persistence pairs you want to use. If your input files consist only ";
+ std::cout << "of birth-death pairs, please set this first parameter to -1 \n";
+ std::cout << "The remaining parameters of the program are the names of files with persistence diagrams. \n";
std::vector< const char* > filenames;
- for ( int i = 1 ; i < argc ; ++i )
+ int dim = atoi(argv[1]);
+ unsigned dimension = std::numeric_limits<unsigned>::max();
+ if ( (dim != -1) && (dim >= 0) )
+ {
+ dimension = (unsigned)dim;
+ }
+ for ( int i = 2 ; i < argc ; ++i )
{
filenames.push_back( argv[i] );
}
@@ -42,8 +52,7 @@ int main( int argc , char** argv )
std::cout << "Creating persistence landscapes...\n";
for ( size_t i = 0 ; i != filenames.size() ; ++i )
{
- //std::vector< std::pair< double , double > > pers = read_standard_file( filename );
- Persistence_landscape l( filenames[i] , 1 );
+ Persistence_landscape l( filenames[i] , dimension );
std::stringstream ss;
ss << filenames[i] << ".land";
l.print_to_file( ss.str().c_str() );
diff --git a/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp
index 4f36f02d..eb534bf1 100644
--- a/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp
+++ b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp
@@ -36,9 +36,12 @@ 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 fourth parameter of the program is the dimension of persistence to be used to construct persistence landscape on a grid. If your file contains ";
+ std::cout << "the information about dimension of birth-death pairs, please provide here the dimension of intervals you want to use. If your input files consist only ";
+ std::cout << "of birth-death pairs, please set the fourth parameter to -1 \n";
std::cout << "The remaining parameters are the names of files with persistence diagrams. \n";
- if ( argc < 4 )
+ if ( argc < 5 )
{
std::cout << "Wrong parameter list, the program will now terminate \n";
return 1;
@@ -47,9 +50,15 @@ int main( int argc , char** argv )
size_t size_of_grid = (size_t)atoi( argv[1] );
double min_ = atof( argv[2] );
double max_ = atof( argv[3] );
+ int dim = atoi( argv[4] );
+ unsigned dimension = std::numeric_limits<unsigned>::max();
+ if ( (dim != -1) && (dim >= 0) )
+ {
+ dimension = (unsigned)dim;
+ }
std::vector< const char* > filenames;
- for ( int i = 4 ; i < argc ; ++i )
+ for ( int i = 5 ; i < argc ; ++i )
{
filenames.push_back( argv[i] );
}
@@ -61,12 +70,12 @@ int main( int argc , char** argv )
Persistence_landscape_on_grid l;
if ( (min_ != -1) || (max_ != -1) )
{
- l = Persistence_landscape_on_grid( filenames[i] , min_ , max_ , size_of_grid );
+ l = Persistence_landscape_on_grid( filenames[i] , min_ , max_ , size_of_grid , dimension );
}
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 );
+ l = Persistence_landscape_on_grid( filenames[i] , size_of_grid , dimension );
}
std::stringstream ss;
ss << filenames[i] << ".g_land";
diff --git a/src/Gudhi_stat/utilities/persistence_vectors/create_persistence_vectors.cpp b/src/Gudhi_stat/utilities/persistence_vectors/create_persistence_vectors.cpp
index fc434ba8..40f5e81f 100644
--- a/src/Gudhi_stat/utilities/persistence_vectors/create_persistence_vectors.cpp
+++ b/src/Gudhi_stat/utilities/persistence_vectors/create_persistence_vectors.cpp
@@ -33,9 +33,19 @@ using namespace Gudhi::Gudhi_stat;
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::cout << "This program creates persistence vectors of diagrams provided as an input. The first parameter of this program is a dimension of persistence ";
+ std::cout << " that will be used in creation of the persistence vectors. If our input files contain persistence pairs of various dimension, as a second parameter of the ";
+ std::cout << " procedure please provide the dimension of persistence you want to use. If in your file there are only birth-death pairs of the same dimension, set the first parameter to -1." << std::endl;
+ std::cout << "The remaining parameters are the names of files with persistence diagrams. \n";
+ int dim = atoi( argv[1] );
+ unsigned dimension = std::numeric_limits<unsigned>::max();
+ if ( (dim != -1) && (dim >= 0) )
+ {
+ dimension = (unsigned)dim;
+ }
+
std::vector< const char* > filenames;
- for ( int i = 1 ; i < argc ; ++i )
+ for ( int i = 2 ; i < argc ; ++i )
{
filenames.push_back( argv[i] );
}
@@ -44,7 +54,7 @@ int main( int argc , char** argv )
{
std::cerr << "Creatign persistence vectors based on a file : " << filenames[i] << std::endl;
//std::vector< std::pair< double , double > > persistence_pairs = read_gudhi_persistence_file_in_one_dimension( filenames[i] , size_t dimension = 0 )
- Vector_distances_in_diagram< Euclidean_distance > l( filenames[i] , -1 );
+ Vector_distances_in_diagram< Euclidean_distance > l( filenames[i] , dimension );
std::stringstream ss;
ss << filenames[i] << ".vect";
l.print_to_file( ss.str().c_str() );