summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-04-14 07:44:21 +0000
committerpdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-04-14 07:44:21 +0000
commit399033b54b3f84ae1860665ca2071436ff010582 (patch)
tree24b735325f5ceb39b88dcdeb2cd7afdaf51a4c1a /src
parent564deeab5f8c3b6251016e08cbecf1c47c7f5610 (diff)
Answer to Vincent's comments.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/gudhi_stat@2348 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 14d2d7d14089c17e4e7949b1f8e46990d0b16181
Diffstat (limited to 'src')
-rw-r--r--src/Gudhi_stat/doc/gudhi_stat_doc.h4
-rw-r--r--src/Gudhi_stat/example/CMakeLists.txt5
-rw-r--r--src/Gudhi_stat/example/simple_diagram.txt4
-rw-r--r--src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_heat_maps.h14
-rw-r--r--src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape.h7
-rw-r--r--src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape_on_grid.h10
-rw-r--r--src/Gudhi_stat/include/gudhi/persistence_representations/persistence_vectors.h8
-rw-r--r--src/Gudhi_stat/include/gudhi/read_persistence_from_file.h42
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/CMakeLists.txt34
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp6
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/create_pssk.cpp1
-rw-r--r--src/Gudhi_stat/utilities/persistence_heat_maps/simple_diagram.txt.mps11
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt7
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/compute_bottleneck_distance.cpp4
-rw-r--r--src/Gudhi_stat/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp2
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes/CMakeLists.txt11
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes/simple_diagram.txt.land13
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes_on_grid/CMakeLists.txt11
-rw-r--r--src/Gudhi_stat/utilities/persistence_landscapes_on_grid/simple_diagram.txt.g_land104
-rw-r--r--src/Gudhi_stat/utilities/persistence_vectors/CMakeLists.txt11
-rw-r--r--src/Gudhi_stat/utilities/persistence_vectors/simple_diagram.txt.vect1
-rw-r--r--src/Gudhi_stat/utilities/sliding_window_embedding.cpp1
22 files changed, 244 insertions, 67 deletions
diff --git a/src/Gudhi_stat/doc/gudhi_stat_doc.h b/src/Gudhi_stat/doc/gudhi_stat_doc.h
index cbff56d6..b2162c49 100644
--- a/src/Gudhi_stat/doc/gudhi_stat_doc.h
+++ b/src/Gudhi_stat/doc/gudhi_stat_doc.h
@@ -81,6 +81,7 @@ namespace Gudhi_stat {
*Below we are discussing the representations which are currently implemented in Gudhi\_stat:
*
*\section sec_persistence_landscapes Persistence Landscapes
+ * Reference manual: \ref Gudhi::Gudhi_stat::Persistence_landscape
*Persistence landscapes were originally proposed by Bubenik in \cite bubenik_landscapes_2015. Efficient algorithms to compute them rigorously were proposed by Bubenik and Dlotko in \cite bubenik_dlotko_landscapes_2016. The idea of
* persistence landscapes is shortly summarized in below.
*
@@ -119,6 +120,7 @@ namespace Gudhi_stat {
*
*
*\section sec_landscapes_on_grid Persistence Landscapes on a grid
+ * Reference manual: \ref Gudhi::Gudhi_stat::Persistence_landscape_on_grid
*This is an alternative, not--exact, representation of persistence landscapes defined in the Section \ref sec_persistence_landscapes. Unlike in the Section \ref sec_persistence_landscapes we build a
* representation of persistence landscape by sampling its values on a finite, equally distributed grid of points.
* Since, the persistence landscapes that originate from persistence diagrams have slope \f$1\f$ or \f$-1\f$, we have an estimate of a region between the grid points where the landscape cab be located.
@@ -151,6 +153,7 @@ namespace Gudhi_stat {
*Note that the same representation is used in TDA R-package \cite Fasy_Kim_Lecci_Maria_tda.
*
*\section sec_persistence_heat_maps Persistence heat maps
+ * Reference manual: \ref Gudhi::Gudhi_stat::Persistence heat maps
*This is a general class of discrete structures which are based on idea of placing a kernel in the points of persistence diagrams.
*This idea appeared in work by many authors over the last 15 years. As far as we know this idea was firstly described in the work of Bologna group in \cite Ferri_Frosini_comparision_sheme_1 and \cite Ferri_Frosini_comparision_sheme_2.
*Later it has been described by Colorado State University group in \cite Persistence_Images_2017. The presented paper in the first time provide a discussion of stability of the representation.
@@ -174,6 +177,7 @@ namespace Gudhi_stat {
*
*
*\section sec_persistence_vectors Persistence vectors
+ * Reference manual: \ref Gudhi::Gudhi_stat::Persistence vectors
*This is a representation of persistent homology in a form of a vector which was designed for an application in 3d graphic in \cite Carriere_Oudot_Ovsjanikov_top_signatures_3d. Below we provide a short description of this representation.
*
*Given a persistence diagram \f$D = \{ (b_i,d_i) \}\f$, for every pair of birth--death points \f$(b_1,d_1)\f$ and \f$(b_2,d_2)\f$ we compute the following three distances:
diff --git a/src/Gudhi_stat/example/CMakeLists.txt b/src/Gudhi_stat/example/CMakeLists.txt
index 61ea6d4f..2df9d5a4 100644
--- a/src/Gudhi_stat/example/CMakeLists.txt
+++ b/src/Gudhi_stat/example/CMakeLists.txt
@@ -3,18 +3,23 @@ project(GUDHI_STAT)
add_executable ( persistence_landscape_on_grid persistence_landscape_on_grid.cpp )
target_link_libraries(persistence_landscape_on_grid ${Boost_SYSTEM_LIBRARY})
+add_test ( persistence_landscape_on_grid ${CMAKE_CURRENT_BINARY_DIR}/persistence_landscape_on_grid )
add_executable ( persistence_landscape persistence_landscape.cpp )
target_link_libraries(persistence_landscape ${Boost_SYSTEM_LIBRARY})
+add_test ( persistence_landscape ${CMAKE_CURRENT_BINARY_DIR}/persistence_landscape )
add_executable ( persistence_intervals persistence_intervals.cpp )
target_link_libraries(persistence_intervals ${Boost_SYSTEM_LIBRARY})
+add_test ( persistence_intervals ${CMAKE_CURRENT_BINARY_DIR}/persistence_intervals simple_diagram.txt )
add_executable ( persistence_vectors persistence_vectors.cpp )
target_link_libraries(persistence_vectors ${Boost_SYSTEM_LIBRARY})
+add_test ( persistence_vectors ${CMAKE_CURRENT_BINARY_DIR}/persistence_vectors )
add_executable ( persistence_heat_maps persistence_heat_maps.cpp )
target_link_libraries(persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
+add_test ( persistence_heat_maps ${CMAKE_CURRENT_BINARY_DIR}/persistence_heat_maps )
diff --git a/src/Gudhi_stat/example/simple_diagram.txt b/src/Gudhi_stat/example/simple_diagram.txt
new file mode 100644
index 00000000..2f199fd4
--- /dev/null
+++ b/src/Gudhi_stat/example/simple_diagram.txt
@@ -0,0 +1,4 @@
+1 2
+3 4
+5 6
+7 8 \ No newline at end of file
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 3cfd52f5..56890267 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
@@ -576,9 +576,12 @@ void Persistence_heat_maps<Scalling_of_kernels>::construct( const std::vector< s
if ( dbg )std::cerr << "Entering construct procedure \n";
Scalling_of_kernels f;
this->f = f;
+
+ if ( dbg )std::cerr << "min and max passed to construct() procedure: " << min_ << " " << max_ << std::endl;
if ( min_ == max_ )
{
+ if (dbg)std::cerr << "min and max parameters will be etermined based on intervals \n";
//in this case, we want the program to set up the min_ and max_ values by itself.
min_ = std::numeric_limits<int>::max();
max_ = -std::numeric_limits<int>::max();
@@ -705,8 +708,13 @@ Persistence_heat_maps<Scalling_of_kernels>::Persistence_heat_maps( const char* f
else
{
intervals_ = read_persistence_intervals_in_one_dimension_from_file( filename , dimension );
- }
- this->construct( intervals_ , filter, erase_below_diagonal , number_of_pixels , min_ , max_ );
+ }
+ //std::cerr << "intervals_.size() : " << intervals_.size() << std::endl;
+ //for ( size_t i = 0 ; i != intervals_.size() ; ++i )
+ //{
+ // std::cerr << intervals_[i].first << " " << intervals_[i].second << std::endl;
+ //}
+ this->construct( intervals_ , filter, erase_below_diagonal , number_of_pixels , min_ , max_ );
this->set_up_parameters_for_basic_classes();
}
@@ -865,7 +873,7 @@ void Persistence_heat_maps<Scalling_of_kernels>::load_from_file( const char* fil
in.open( filename );
//checking if the file exist / if it was open.
- if ( !( access( filename, F_OK ) != -1 ) )
+ if ( !in.good() )
{
std::cerr << "The file : " << filename << " do not exist. The program will now terminate \n";
throw "The file from which you are trying to read the persistence landscape do not exist. The program will now terminate \n";
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 925d784f..c274a81f 100644
--- a/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape.h
+++ b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_landscape.h
@@ -32,7 +32,6 @@
#include <fstream>
#include <sstream>
#include <algorithm>
-#include <unistd.h>
//gudhi include
@@ -1028,9 +1027,9 @@ void Persistence_landscape::load_landscape_from_file( const char* filename )
//this constructor reads persistence landscape form a file. This file have to be created by this software beforehead
- std::ifstream in;
- in.open( filename );
- if ( !( access( filename, F_OK ) != -1 ) )
+ std::ifstream in;
+ in.open( filename );
+ if ( !in.good() )
{
std::cerr << "The file : " << filename << " do not exist. The program will now terminate \n";
throw "The file from which you are trying to read the persistence landscape do not exist. The program will now terminate \n";
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 3103172d..3d51c0a7 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
@@ -31,7 +31,6 @@
#include <fstream>
#include <sstream>
#include <algorithm>
-#include <unistd.h>
#include <cmath>
#include <limits>
@@ -1018,7 +1017,7 @@ public:
-
+
@@ -1328,16 +1327,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_ , number_of_levels_of_landscape );
}
+
void Persistence_landscape_on_grid::load_landscape_from_file( const char* filename )
{
+ std::ifstream in;
+ in.open( filename );
//check if the file exist.
- if ( !( access( filename, F_OK ) != -1 ) )
+ if ( !in.good() )
{
std::cerr << "The file : " << filename << " do not exist. The program will now terminate \n";
throw "The file from which you are trying to read the persistence landscape do not exist. The program will now terminate \n";
}
- std::ifstream in;
- in.open( filename );
size_t number_of_points_in_the_grid = 0;
in >> this->grid_min >> this->grid_max >> number_of_points_in_the_grid;
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 aa1f23c2..d56f92c4 100644
--- a/src/Gudhi_stat/include/gudhi/persistence_representations/persistence_vectors.h
+++ b/src/Gudhi_stat/include/gudhi/persistence_representations/persistence_vectors.h
@@ -734,15 +734,15 @@ void Vector_distances_in_diagram<F>::write_to_file( const char* filename )const
template < typename F>
void Vector_distances_in_diagram<F>::load_from_file( const char* filename )
{
+ std::ifstream in;
+ in.open( filename );
//check if the file exist.
- if ( !( access( filename, F_OK ) != -1 ) )
+ if ( !in.good() )
{
std::cerr << "The file : " << filename << " do not exist. The program will now terminate \n";
throw "The file from which you are trying to read the persistence landscape do not exist. The program will now terminate \n";
}
- std::ifstream in;
- in.open( filename );
-
+
double number;
while ( true )
{
diff --git a/src/Gudhi_stat/include/gudhi/read_persistence_from_file.h b/src/Gudhi_stat/include/gudhi/read_persistence_from_file.h
index a340b40c..5042826c 100644
--- a/src/Gudhi_stat/include/gudhi/read_persistence_from_file.h
+++ b/src/Gudhi_stat/include/gudhi/read_persistence_from_file.h
@@ -29,7 +29,7 @@
#include <sstream>
#include <vector>
#include <algorithm>
-#include <unistd.h>
+
namespace Gudhi
@@ -47,7 +47,8 @@ std::vector< std::pair< double,double > > read_persistence_file_that_may_contain
bool dbg = true;
- if ( !( access( filename, F_OK ) != -1 ) )
+ std::ifstream in(filename);
+ if ( !in.good() )
{
std::cerr << "The file : " << filename << " do not exist. The program will now terminate \n";
throw "The file from which you are trying to read do not exist. The program will now terminate \n";
@@ -55,9 +56,7 @@ std::vector< std::pair< double,double > > read_persistence_file_that_may_contain
std::string line;
std::vector< std::pair<double,double> > barcode;
-
- std::ifstream in;
- in.open( filename );
+
while (!in.eof())
{
getline(in,line);
@@ -108,15 +107,14 @@ std::vector< std::string > readFileNames( const char* filenameWithFilenames )
{
bool dbg = false;
- if ( !( access( filenameWithFilenames, F_OK ) != -1 ) )
+ std::ifstream in(filenameWithFilenames);
+ if ( !in.good() )
{
std::cerr << "The file : " << filenameWithFilenames << " do not exist. The program will now terminate \n";
throw "The file from which you are trying to read do not exist. The program will now terminate \n";
}
- std::vector< std::string > result;
- std::ifstream in;
- in.open( filenameWithFilenames );
+ std::vector< std::string > result;
std::string line;
while (!in.eof())
{
@@ -154,7 +152,7 @@ std::vector< std::pair< double , double > > read_standard_persistence_file( cons
std::ifstream in;
in.open( filename );
- if ( !( access( filename, F_OK ) != -1 ) )
+ if ( !in.good() )
{
std::cerr << "The file : " << filename << " do not exist. The program will now terminate \n";
throw "The file from which you are trying to read the persistence landscape do not exist. The program will now terminate \n";
@@ -204,13 +202,14 @@ std::vector< std::pair< double , double > > read_standard_persistence_file( cons
std::vector< std::pair< double , double > > read_gudhi_persistence_file_in_one_dimension( const char* filename , size_t dimension = 0 , double what_to_substitute_for_infinite_bar = -1)
{
bool dbg = false;
- if ( !( access( filename, F_OK ) != -1 ) )
+ std::ifstream in;
+ in.open( filename );
+ if ( !in.good() )
{
std::cerr << "The file : " << filename << " do not exist. The program will now terminate \n";
throw "The file from which you are trying to read the persistence landscape do not exist. The program will now terminate \n";
}
- std::ifstream in;
- in.open( filename );
+
std::string line;
std::vector< std::pair<double,double> > barcode;
@@ -279,7 +278,8 @@ std::vector< std::pair< double , double > > read_gudhi_persistence_file_in_one_d
std::vector< std::vector< double > > read_numbers_from_file_line_by_line( const char* filename )
{
bool dbg = false;
- if ( !( access( filename, F_OK ) != -1 ) )
+ std::ifstream in(filename);
+ if ( !in.good() )
{
std::cerr << "The file : " << filename << " do not exist. The program will now terminate \n";
throw "The file from which you are trying to read the persistence landscape do not exist. The program will now terminate \n";
@@ -288,7 +288,7 @@ std::vector< std::vector< double > > read_numbers_from_file_line_by_line( const
std::vector< std::vector< double > > result;
double number;
- std::ifstream in(filename);
+
std::string line;
while ( in.good() )
{
@@ -325,17 +325,17 @@ std::vector< std::vector< double > > read_numbers_from_file_line_by_line( const
std::vector<std::pair<double,double>> read_persistence_intervals_in_one_dimension_from_file(std::string const& filename, int dimension=-1 , double what_to_substitute_for_infinite_bar = -1 )
{
bool dbg = false;
-
+ std::ifstream in;
+ in.open( filename );
//checking if the file exist:
- if ( !( access( filename.c_str() , F_OK ) != -1 ) )
+ if ( !in.good() )
{
std::cerr << "The file : " << filename << " do not exist. The program will now terminate \n";
throw "The file from which you are trying to read the persistence landscape do not exist. The program will now terminate \n";
}
- std::ifstream in;
- in.open( filename );
+
std::string line;
std::vector< std::pair<double,double> > barcode;
@@ -352,8 +352,8 @@ std::vector<std::pair<double,double>> read_persistence_intervals_in_one_dimensio
{
//check how many entries we have in the line.
std::stringstream ss( line );
- int number;
- std::vector<int> this_line;
+ double number;
+ std::vector<double> this_line;
while ( ss >> number )
{
this_line.push_back( number );
diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/CMakeLists.txt b/src/Gudhi_stat/utilities/persistence_heat_maps/CMakeLists.txt
index 39240db2..07903dda 100644
--- a/src/Gudhi_stat/utilities/persistence_heat_maps/CMakeLists.txt
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/CMakeLists.txt
@@ -2,30 +2,40 @@ cmake_minimum_required(VERSION 2.6)
project(GUDHI_STAT)
#persitence heat maps
-add_executable ( average_persistence_heat_maps average_persistence_heat_maps.cpp )
-target_link_libraries(average_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
add_executable ( create_persistence_heat_maps create_persistence_heat_maps.cpp )
target_link_libraries(create_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
-
-add_executable ( plot_persistence_heat_map plot_persistence_heat_map.cpp )
-target_link_libraries(plot_persistence_heat_map ${Boost_SYSTEM_LIBRARY})
-
-add_executable ( compute_distance_of_persistence_heat_maps compute_distance_of_persistence_heat_maps.cpp )
-target_link_libraries(compute_distance_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
-
-add_executable ( compute_scalar_product_of_persistence_heat_maps compute_scalar_product_of_persistence_heat_maps.cpp )
-target_link_libraries(compute_scalar_product_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
+add_test ( create_persistence_heat_maps ${CMAKE_CURRENT_BINARY_DIR}/create_persistence_heat_maps 10 -1 -1 4 -1 ../../example/simple_diagram.txt )
add_executable ( create_pssk create_pssk.cpp )
target_link_libraries(create_pssk ${Boost_SYSTEM_LIBRARY})
+add_test ( create_pssk ${CMAKE_CURRENT_BINARY_DIR}/create_pssk 10 -1 -1 4 -1 ../../example/simple_diagram.txt )
-add_executable ( create_persistence_heat_maps_weighted_by_distance_from_diagonal create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp )
+add_executable ( create_persistence_heat_maps_weighted_by_distance_from_diagonal create_persistence_heat_maps_weighted_by_distance_from_diagonal.cpp )
target_link_libraries(create_persistence_heat_maps_weighted_by_distance_from_diagonal ${Boost_SYSTEM_LIBRARY})
+add_test ( create_persistence_heat_maps_weighted_by_distance_from_diagonal ${CMAKE_CURRENT_BINARY_DIR}/create_persistence_heat_maps_weighted_by_distance_from_diagonal 10 -1 -1 4 -1 ../../example/simple_diagram.txt )
add_executable ( create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal.cpp )
target_link_libraries(create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal ${Boost_SYSTEM_LIBRARY})
+add_test ( create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal ${CMAKE_CURRENT_BINARY_DIR}/create_persistence_heat_maps_weighted_by_squared_distance_from_diagonal 10 -1 -1 4 -1 ../../example/simple_diagram.txt )
add_executable ( create_persistence_heat_maps_weighted_by_arctan_of_their_persistence create_persistence_heat_maps_weighted_by_arctan_of_their_persistence.cpp )
target_link_libraries(create_persistence_heat_maps_weighted_by_arctan_of_their_persistence ${Boost_SYSTEM_LIBRARY})
+add_test ( create_persistence_heat_maps_weighted_by_arctan_of_their_persistence ${CMAKE_CURRENT_BINARY_DIR}/create_persistence_heat_maps_weighted_by_arctan_of_their_persistence 10 -1 -1 4 -1 ../../example/simple_diagram.txt )
+
+add_executable ( average_persistence_heat_maps average_persistence_heat_maps.cpp )
+target_link_libraries(average_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
+add_test ( average_persistence_heat_maps ${CMAKE_CURRENT_BINARY_DIR}/average_persistence_heat_maps simple_diagram.txt.mps simple_diagram.txt.mps )
+
+add_executable ( plot_persistence_heat_map plot_persistence_heat_map.cpp )
+target_link_libraries(plot_persistence_heat_map ${Boost_SYSTEM_LIBRARY})
+add_test ( plot_persistence_heat_map ${CMAKE_CURRENT_BINARY_DIR}/plot_persistence_heat_map simple_diagram.txt.mps )
+
+add_executable ( compute_distance_of_persistence_heat_maps compute_distance_of_persistence_heat_maps.cpp )
+target_link_libraries(compute_distance_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
+add_test ( compute_distance_of_persistence_heat_maps ${CMAKE_CURRENT_BINARY_DIR}/compute_distance_of_persistence_heat_maps 1 simple_diagram.txt.mps simple_diagram.txt.mps )
+
+add_executable ( compute_scalar_product_of_persistence_heat_maps compute_scalar_product_of_persistence_heat_maps.cpp )
+target_link_libraries(compute_scalar_product_of_persistence_heat_maps ${Boost_SYSTEM_LIBRARY})
+add_test ( compute_scalar_product_of_persistence_heat_maps ${CMAKE_CURRENT_BINARY_DIR}/compute_scalar_product_of_persistence_heat_maps simple_diagram.txt.mps simple_diagram.txt.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 ecef449a..351cfd6f 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
@@ -62,8 +62,10 @@ int main( int argc , char** argv )
dimension = (unsigned)dim;
}
+ //std::cout << "Parameters of the program : size_of_grid : " << size_of_grid << ", min_ : " << min_ << ", max_ : " << max_ << ", stdiv: " << stdiv << ", dim : " << dim << std::endl;
+
std::vector< const char* > filenames;
- for ( int i = 6 ; i < argc ; ++i )
+ for ( int i = 6 ; i != argc ; ++i )
{
filenames.push_back( argv[i] );
}
@@ -76,7 +78,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_ , dimension );
+ Persistence_heat_maps<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 78989ccc..dfab5cdb 100644
--- a/src/Gudhi_stat/utilities/persistence_heat_maps/create_pssk.cpp
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/create_pssk.cpp
@@ -38,7 +38,6 @@ 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;
diff --git a/src/Gudhi_stat/utilities/persistence_heat_maps/simple_diagram.txt.mps b/src/Gudhi_stat/utilities/persistence_heat_maps/simple_diagram.txt.mps
new file mode 100644
index 00000000..b7643887
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_heat_maps/simple_diagram.txt.mps
@@ -0,0 +1,11 @@
+0.93 8.0707
+0.0492104 0.03889 0.0190956 0.00603584 0.00131569 0.000120934 2.10152e-05 0 0 0
+0.0650745 0.0539306 0.0296488 0.011745 0.00357642 0.000695928 0.000120934 0 0 0
+0.0572665 0.0559446 0.0409942 0.0230905 0.00937173 0.00242903 0.000422102 0 0 0
+0.0409942 0.0559656 0.0573874 0.0408475 0.0192639 0.00628964 0.00178718 0.000422102 0.000120934 2.10152e-05
+0.0296488 0.0540515 0.0657704 0.0519133 0.0283092 0.0132056 0.00628964 0.00242903 0.000695928 0.000120934
+0.0190956 0.0393121 0.0516395 0.0465955 0.0359385 0.0283092 0.0192639 0.00937173 0.00357642 0.00131569
+0.00847814 0.0188418 0.0281882 0.0358964 0.0465955 0.0519133 0.0408475 0.0230905 0.011745 0.00603584
+0.00242903 0.00628964 0.0132056 0.0281882 0.0516395 0.0657704 0.0573874 0.0409942 0.0296488 0.0190956
+0.000422102 0.00178718 0.00628964 0.0188418 0.0393121 0.0540515 0.0559656 0.0559446 0.0539306 0.03889
+0 0.000422102 0.00242903 0.00847814 0.0190956 0.0296488 0.0409942 0.0572665 0.0650745 0.0492104
diff --git a/src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt b/src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt
index 9420a8ea..a317bd67 100644
--- a/src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt
+++ b/src/Gudhi_stat/utilities/persistence_intervals/CMakeLists.txt
@@ -4,18 +4,23 @@ project(GUDHI_STAT)
#persitence diagrams
add_executable ( plot_persistence_intervals plot_persistence_intervals.cpp )
target_link_libraries( plot_persistence_intervals ${Boost_SYSTEM_LIBRARY})
+add_test ( plot_persistence_intervals ${CMAKE_CURRENT_BINARY_DIR}/plot_persistence_intervals ../../example/simple_diagram.txt )
add_executable ( compute_birth_death_range_in_persistence_diagram compute_birth_death_range_in_persistence_diagram.cpp )
target_link_libraries( compute_birth_death_range_in_persistence_diagram ${Boost_SYSTEM_LIBRARY})
+add_test ( compute_birth_death_range_in_persistence_diagram ${CMAKE_CURRENT_BINARY_DIR}/compute_birth_death_range_in_persistence_diagram -1 ../../example/simple_diagram.txt )
add_executable ( compute_number_of_dominant_intervals compute_number_of_dominant_intervals.cpp )
target_link_libraries( compute_number_of_dominant_intervals ${Boost_SYSTEM_LIBRARY})
+add_test ( compute_number_of_dominant_intervals ${CMAKE_CURRENT_BINARY_DIR}/compute_number_of_dominant_intervals ../../example/simple_diagram.txt -1 2 )
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_test ( plot_histogram_of_intervals_lengths ${CMAKE_CURRENT_BINARY_DIR}/plot_histogram_of_intervals_lengths ../../example/simple_diagram.txt 2 )
add_executable ( plot_persistence_Betti_numbers plot_persistence_Betti_numbers.cpp )
target_link_libraries( plot_persistence_Betti_numbers ${Boost_SYSTEM_LIBRARY})
+add_test ( plot_persistence_Betti_numbers ${CMAKE_CURRENT_BINARY_DIR}/plot_persistence_Betti_numbers ../../example/simple_diagram.txt )
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
add_executable ( compute_bottleneck_distance compute_bottleneck_distance.cpp )
@@ -23,5 +28,5 @@ target_link_libraries( compute_bottleneck_distance ${Boost_SYSTEM_LIBRARY})
if (TBB_FOUND)
target_link_libraries(compute_bottleneck_distance ${TBB_LIBRARIES})
endif(TBB_FOUND)
-
+add_test ( compute_bottleneck_distance ${CMAKE_CURRENT_BINARY_DIR}/compute_bottleneck_distance ../../example/simple_diagram.txt ../../example/simple_diagram.txt )
endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
diff --git a/src/Gudhi_stat/utilities/persistence_intervals/compute_bottleneck_distance.cpp b/src/Gudhi_stat/utilities/persistence_intervals/compute_bottleneck_distance.cpp
index d8b533cf..43929695 100644
--- a/src/Gudhi_stat/utilities/persistence_intervals/compute_bottleneck_distance.cpp
+++ b/src/Gudhi_stat/utilities/persistence_intervals/compute_bottleneck_distance.cpp
@@ -64,9 +64,7 @@ int main( int argc , char** argv )
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_with_distances pers(filenames[i] , dimension );
persistence_intervals.push_back( pers );
}
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 acfb0eed..994c6913 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,7 +39,7 @@ 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";
+ std::cout << "The third 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();
diff --git a/src/Gudhi_stat/utilities/persistence_landscapes/CMakeLists.txt b/src/Gudhi_stat/utilities/persistence_landscapes/CMakeLists.txt
index 9caf73f6..9eda94a2 100644
--- a/src/Gudhi_stat/utilities/persistence_landscapes/CMakeLists.txt
+++ b/src/Gudhi_stat/utilities/persistence_landscapes/CMakeLists.txt
@@ -4,18 +4,23 @@ project(GUDHI_STAT)
#persitence landscapes
-add_executable ( average_landscapes average_landscapes.cpp )
-target_link_libraries(average_landscapes ${Boost_SYSTEM_LIBRARY})
-
add_executable ( create_landscapes create_landscapes.cpp )
target_link_libraries(create_landscapes ${Boost_SYSTEM_LIBRARY})
+add_test ( create_landscapes ${CMAKE_CURRENT_BINARY_DIR}/create_landscapes -1 ../../example/simple_diagram.txt )
+
+add_executable ( average_landscapes average_landscapes.cpp )
+target_link_libraries(average_landscapes ${Boost_SYSTEM_LIBRARY})
+add_test ( average_landscapes ${CMAKE_CURRENT_BINARY_DIR}/average_landscapes simple_diagram.txt.land simple_diagram.txt.land simple_diagram.txt.land )
add_executable ( plot_landscapes plot_landscapes.cpp )
target_link_libraries(plot_landscapes ${Boost_SYSTEM_LIBRARY})
+add_test ( plot_landscapes ${CMAKE_CURRENT_BINARY_DIR}/plot_landscapes simple_diagram.txt.land )
add_executable ( compute_distance_of_landscapes compute_distance_of_landscapes.cpp )
target_link_libraries(compute_distance_of_landscapes ${Boost_SYSTEM_LIBRARY})
+add_test ( compute_distance_of_landscapes ${CMAKE_CURRENT_BINARY_DIR}/compute_distance_of_landscapes 1 simple_diagram.txt.land simple_diagram.txt.land )
add_executable ( compute_scalar_product_of_landscapes compute_scalar_product_of_landscapes.cpp )
target_link_libraries(compute_scalar_product_of_landscapes ${Boost_SYSTEM_LIBRARY})
+add_test ( compute_scalar_product_of_landscapes ${CMAKE_CURRENT_BINARY_DIR}/compute_scalar_product_of_landscapes simple_diagram.txt.land simple_diagram.txt.land )
diff --git a/src/Gudhi_stat/utilities/persistence_landscapes/simple_diagram.txt.land b/src/Gudhi_stat/utilities/persistence_landscapes/simple_diagram.txt.land
new file mode 100644
index 00000000..b99d2f62
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_landscapes/simple_diagram.txt.land
@@ -0,0 +1,13 @@
+#lambda_0
+1 0
+1.5 0.5
+2 0
+3 0
+3.5 0.5
+4 0
+5 0
+5.5 0.5
+6 0
+7 0
+7.5 0.5
+8 0
diff --git a/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/CMakeLists.txt b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/CMakeLists.txt
index bb7c3987..639b3d3d 100644
--- a/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/CMakeLists.txt
+++ b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/CMakeLists.txt
@@ -5,18 +5,23 @@ project(GUDHI_STAT)
#persitence landscapes on a grid
-add_executable ( average_landscapes_on_grid average_landscapes_on_grid.cpp )
-target_link_libraries(average_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
-
add_executable ( create_landscapes_on_grid create_landscapes_on_grid.cpp )
target_link_libraries(create_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
+add_test ( create_landscapes_on_grid ${CMAKE_CURRENT_BINARY_DIR}/create_landscapes_on_grid 100 -1 -1 -1 ../../example/simple_diagram.txt )
+
+add_executable ( average_landscapes_on_grid average_landscapes_on_grid.cpp )
+target_link_libraries(average_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
+add_test ( average_landscapes_on_grid ${CMAKE_CURRENT_BINARY_DIR}/average_landscapes_on_grid simple_diagram.txt.g_land simple_diagram.txt.g_land )
add_executable ( plot_landscapes_on_grid plot_landscapes_on_grid.cpp )
target_link_libraries(plot_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
+add_test ( plot_landscapes_on_grid ${CMAKE_CURRENT_BINARY_DIR}/plot_landscapes_on_grid simple_diagram.txt.g_land simple_diagram.txt.g_land )
add_executable ( compute_distance_of_landscapes_on_grid compute_distance_of_landscapes_on_grid.cpp )
target_link_libraries(compute_distance_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
+add_test ( compute_distance_of_landscapes_on_grids ${CMAKE_CURRENT_BINARY_DIR}/compute_distance_of_landscapes_on_grid simple_diagram.txt.g_land simple_diagram.txt.g_land )
add_executable ( compute_scalar_product_of_landscapes_on_grid compute_scalar_product_of_landscapes_on_grid.cpp )
target_link_libraries(compute_scalar_product_of_landscapes_on_grid ${Boost_SYSTEM_LIBRARY})
+add_test ( compute_scalar_product_of_landscapes_on_grid ${CMAKE_CURRENT_BINARY_DIR}/compute_scalar_product_of_landscapes_on_grid simple_diagram.txt.g_land simple_diagram.txt.g_land )
diff --git a/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/simple_diagram.txt.g_land b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/simple_diagram.txt.g_land
new file mode 100644
index 00000000..dc53b932
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_landscapes_on_grid/simple_diagram.txt.g_land
@@ -0,0 +1,104 @@
+1
+8
+101
+
+0.07
+0.14
+0.21
+0.28
+0.35
+0.42
+0.49
+0.42
+0.35
+0.28
+0.21
+0.14
+0.07
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+0.07
+0.14
+0.21
+0.28
+0.35
+0.42
+0.49
+0.42
+0.35
+0.28
+0.21
+0.14
+0.07
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+0.07
+0.14
+0.21
+0.28
+0.35
+0.42
+0.49
+0.42
+0.35
+0.28
+0.21
+0.14
+0.07
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+0.07
+0.14
+0.21
+0.28
+0.35
+0.42
+0.49
+0.42
+0.35
+0.28
+0.21
+0.14
+0.07
+
+
diff --git a/src/Gudhi_stat/utilities/persistence_vectors/CMakeLists.txt b/src/Gudhi_stat/utilities/persistence_vectors/CMakeLists.txt
index ebf4898e..25742c2e 100644
--- a/src/Gudhi_stat/utilities/persistence_vectors/CMakeLists.txt
+++ b/src/Gudhi_stat/utilities/persistence_vectors/CMakeLists.txt
@@ -2,19 +2,24 @@ cmake_minimum_required(VERSION 2.6)
project(GUDHI_STAT)
#persitence vectors
-add_executable ( average_persistence_vectors average_persistence_vectors.cpp )
-target_link_libraries(average_persistence_vectors ${Boost_SYSTEM_LIBRARY})
-
add_executable ( create_persistence_vectors create_persistence_vectors.cpp )
target_link_libraries(create_persistence_vectors ${Boost_SYSTEM_LIBRARY})
+add_test ( create_persistence_vectors ${CMAKE_CURRENT_BINARY_DIR}/create_persistence_vectors -1 ../../example/simple_diagram.txt )
+
+add_executable ( average_persistence_vectors average_persistence_vectors.cpp )
+target_link_libraries(average_persistence_vectors ${Boost_SYSTEM_LIBRARY})
+add_test ( average_persistence_vectors ${CMAKE_CURRENT_BINARY_DIR}/average_persistence_vectors simple_diagram.txt.vect simple_diagram.txt.vect )
add_executable ( compute_distance_of_persistence_vectors compute_distance_of_persistence_vectors.cpp )
target_link_libraries(compute_distance_of_persistence_vectors ${Boost_SYSTEM_LIBRARY})
+add_test ( compute_distance_of_persistence_vectors ${CMAKE_CURRENT_BINARY_DIR}/compute_distance_of_persistence_vectors -1 simple_diagram.txt.vect simple_diagram.txt.vect )
add_executable ( compute_scalar_product_of_persistence_vectors compute_scalar_product_of_persistence_vectors.cpp )
target_link_libraries(compute_scalar_product_of_persistence_vectors ${Boost_SYSTEM_LIBRARY})
+add_test ( compute_scalar_product_of_persistence_vectors ${CMAKE_CURRENT_BINARY_DIR}/compute_scalar_product_of_persistence_vectors simple_diagram.txt.vect simple_diagram.txt.vect )
add_executable ( plot_persistence_vectors plot_persistence_vectors.cpp )
target_link_libraries(plot_persistence_vectors ${Boost_SYSTEM_LIBRARY})
+add_test ( plot_persistence_vectors ${CMAKE_CURRENT_BINARY_DIR}/plot_persistence_vectors simple_diagram.txt.vect )
diff --git a/src/Gudhi_stat/utilities/persistence_vectors/simple_diagram.txt.vect b/src/Gudhi_stat/utilities/persistence_vectors/simple_diagram.txt.vect
new file mode 100644
index 00000000..1d4eeaaf
--- /dev/null
+++ b/src/Gudhi_stat/utilities/persistence_vectors/simple_diagram.txt.vect
@@ -0,0 +1 @@
+0.707107 0.707107 0.707107 0.707107 0.707107 0.707107 0.707107 0.707107 0.707107 0.707107 \ No newline at end of file
diff --git a/src/Gudhi_stat/utilities/sliding_window_embedding.cpp b/src/Gudhi_stat/utilities/sliding_window_embedding.cpp
index 1373b52c..84e8f827 100644
--- a/src/Gudhi_stat/utilities/sliding_window_embedding.cpp
+++ b/src/Gudhi_stat/utilities/sliding_window_embedding.cpp
@@ -5,7 +5,6 @@
#include <sstream>
#include <cstdlib>
#include <sys/stat.h>
-#include <unistd.h>
#include <string>
#include <gudhi/time_series_analysis/sliding_window.h>