summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-12-09 19:35:19 +0000
committerpdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-12-09 19:35:19 +0000
commit74ab2f3b7d7d616c78d4c116ab5e8c629a7fe9d6 (patch)
tree66edf914df2d88d2548dccb620e0c70ca983947a
parentb7b23c26b855b83d03870cfd90b001fa2dedfd86 (diff)
Ansvers to Marc's comments, part deux.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/gudhi_stat@1842 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 361a254ad0837a344801c46049e09fb3b271bb0c
-rw-r--r--src/Gudhi_stat/concept/Real_valued_topological_data.h2
-rw-r--r--src/Gudhi_stat/doc/documentation.pdfbin158173 -> 158097 bytes
-rw-r--r--src/Gudhi_stat/doc/documentation.tex2
-rw-r--r--src/Gudhi_stat/example/persistence_heat_maps.cpp10
-rw-r--r--src/Gudhi_stat/example/vector_representation.cpp2
-rw-r--r--src/Gudhi_stat/include/gudhi/concretizations/Persistence_heat_maps.h28
-rw-r--r--src/Gudhi_stat/include/gudhi/concretizations/Persistence_intervals.h10
-rw-r--r--src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape.h59
-rw-r--r--src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape_on_grid.h16
-rw-r--r--src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h6
-rw-r--r--src/Gudhi_stat/include/gudhi/topological_process.h21
-rw-r--r--src/Gudhi_stat/test/persistence_lanscapes_test.cpp16
12 files changed, 77 insertions, 95 deletions
diff --git a/src/Gudhi_stat/concept/Real_valued_topological_data.h b/src/Gudhi_stat/concept/Real_valued_topological_data.h
index ead22bf4..4d4ee8d3 100644
--- a/src/Gudhi_stat/concept/Real_valued_topological_data.h
+++ b/src/Gudhi_stat/concept/Real_valued_topological_data.h
@@ -33,6 +33,6 @@ public:
/**
* This is a function to compute the projection from this container to reals. The parameter of a function have to be between 0 and the value returned by number_of_projections_to_R().
**/
- double project_to_R;
+ double project_to_R( size_t number_of_projection );
};
diff --git a/src/Gudhi_stat/doc/documentation.pdf b/src/Gudhi_stat/doc/documentation.pdf
index 40bbea28..db8a7f1a 100644
--- a/src/Gudhi_stat/doc/documentation.pdf
+++ b/src/Gudhi_stat/doc/documentation.pdf
Binary files differ
diff --git a/src/Gudhi_stat/doc/documentation.tex b/src/Gudhi_stat/doc/documentation.tex
index a2430fc6..e89a8434 100644
--- a/src/Gudhi_stat/doc/documentation.tex
+++ b/src/Gudhi_stat/doc/documentation.tex
@@ -134,7 +134,7 @@ The detailed description of algorithms used to compute persistence landscapes ca
\section{Persistence Landscapes on a grid}
\label{sec:landscapes_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 $1$ or $-1$, we have an estimate of a region between the grid points where the landscape cab be located. That allows to estimate an error make when performing various operations on landscape. Note that we do not have a similar estimation when a landscape is obtained as an average of collection of landscapes, since in this case the slopes of the lines can be arbitrary and we cannot determine the region where the average landscape is located.
+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 $1$ or $-1$, we have an estimate of a region between the grid points where the landscape cab be located. That allows to estimate an error make when performing various operations on landscape. Note that for average landscapes the slope is in range $[-1,1]$ and similar estimate can be used.
Due to a lack of rigorous description of the algorithms to deal with this non--rigorous representaion of persistence landscapes in the literature, we are providing a short discussion of them in below.
diff --git a/src/Gudhi_stat/example/persistence_heat_maps.cpp b/src/Gudhi_stat/example/persistence_heat_maps.cpp
index 1d7a131a..2dd3d46d 100644
--- a/src/Gudhi_stat/example/persistence_heat_maps.cpp
+++ b/src/Gudhi_stat/example/persistence_heat_maps.cpp
@@ -155,8 +155,8 @@ int main( int argc , char** argv )
std::vector< Abs_Topological_data_with_averages* > to_average;
- to_average.push_back( (Abs_Topological_data_with_averages*)(&p) );
- to_average.push_back( (Abs_Topological_data_with_averages*)(&q) );
+ to_average.push_back( &p );
+ to_average.push_back( &q );
Persistence_heat_maps av;
av.compute_average( to_average );
av.plot( "average" );
@@ -169,9 +169,9 @@ int main( int argc , char** argv )
Persistence_heat_maps r( "file_with_diagram_2" , filter , constant_function, false , 1000 , 0 , 10 );
std::vector< Abs_Topological_data_with_averages* > to_average;
- to_average.push_back( (Abs_Topological_data_with_averages*)(&p) );
- to_average.push_back( (Abs_Topological_data_with_averages*)(&q) );
- to_average.push_back( (Abs_Topological_data_with_averages*)(&r) );
+ to_average.push_back( &p );
+ to_average.push_back( &q );
+ to_average.push_back( &r );
Persistence_heat_maps av;
av.compute_average( to_average );
diff --git a/src/Gudhi_stat/example/vector_representation.cpp b/src/Gudhi_stat/example/vector_representation.cpp
index e8963722..20d46d26 100644
--- a/src/Gudhi_stat/example/vector_representation.cpp
+++ b/src/Gudhi_stat/example/vector_representation.cpp
@@ -103,7 +103,7 @@ int main( int argc , char** argv )
cout << "p_prime : " <<p_prime << endl;
- cout << "Distance between input persistence diagrams : " << p.distance( (Abs_Topological_data_with_distances*)(&p_prime) ) << endl;
+ cout << "Distance between input persistence diagrams : " << p.distance( &p_prime ) << endl;
Vector_distances_in_diagram< Euclidean_distance<double> > average;
average.compute_average( {&p,&p_prime} );
diff --git a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_heat_maps.h b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_heat_maps.h
index 22df8d8e..54f4076b 100644
--- a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_heat_maps.h
+++ b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_heat_maps.h
@@ -196,13 +196,13 @@ public:
* (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 -1, in which case the program compute the values based on the data,
- * (6) a max x and y value of points that are to be taken into account. By default it is set to -1, in which case the program compute the values based on the data.
+ * (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 std::vector< std::pair< double,double > > & interval , std::vector< std::vector<double> > filter = create_Gaussian_filter(5,1) , bool erase_below_diagonal = false , size_t number_of_pixels = 1000 , double min_ = -1 , double max_ = -1 );
+ Persistence_heat_maps( const std::vector< std::pair< double,double > > & interval , std::vector< std::vector<double> > filter = create_Gaussian_filter(5,1) , 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() );
/**
- * Construction that takes at the input a name of a file with persistence intervals, a filter (radius 5 by default), a scaling function (constant by default), a boolean value which determines if the area of image below diagonal should, or should not be erased (should by default). The next parameter is the number of pixels in each direction (set to 1000 by default). and min and max values of images (both set to -1 by defaulet. If this is the case, the program will pick the right values based on the data).
+ * Construction that takes at the input a name of a file with persistence intervals, a filter (radius 5 by default), a scaling function (constant by default), a boolean value which determines if the area of image below diagonal should, or should not be erased (should by default). The next parameter is the number of pixels in each direction (set to 1000 by default). and min and max values of images (both set to std::numeric_limits<double>::max() by defaulet. If this is the case, the program will pick the right values based on the data).
**/
/**
* Construction that takes at the input the following parameters:
@@ -210,10 +210,10 @@ public:
* (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 -1, in which case the program compute the values based on the data,
- * (6) a max x and y value of points that are to be taken into account. By default it is set to -1, in which case the program compute the values based on the data.
+ * (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_ = -1 , double max_ = -1 );
+ 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() );
/**
@@ -276,12 +276,12 @@ public:
/**
* Return minimal range value of persistent image.
**/
- inline double give_me_min()const{return this->min_;}
+ inline double get_min()const{return this->min_;}
/**
* Return maximal range value of persistent image.
**/
- inline double give_me_max()const{return this->max_;}
+ inline double get_max()const{return this->max_;}
/**
@@ -502,7 +502,7 @@ public:
/**
* The x-range of the persistence heat map.
**/
- std::pair< double , double > give_me_x_range()const
+ std::pair< double , double > get_x_range()const
{
return std::make_pair( this->min_ , this->max_ );
}
@@ -510,9 +510,9 @@ public:
/**
* The y-range of the persistence heat map.
**/
- std::pair< double , double > give_me_y_range()const
+ std::pair< double , double > get_y_range()const
{
- return this->give_me_x_range();
+ return this->get_x_range();
}
@@ -526,7 +526,7 @@ protected:
void construct( const std::vector< std::pair<double,double> >& intervals_ ,
std::vector< std::vector<double> > filter = create_Gaussian_filter(5,1),
- bool erase_below_diagonal = false , size_t number_of_pixels = 1000 , double min_ = -1 , double max_ = -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() );
void set_up_parameters_for_basic_classes()
{
@@ -923,7 +923,7 @@ double Persistence_heat_maps<Scalling_of_kernels>::distance( const Persistence_h
//if we are here, we know that the two persistence iomages are defined on the same domain, so we can start computing their distances:
double distance = 0;
- if ( power != std::numeric_limits<double>::max() )
+ if ( power < std::numeric_limits<double>::max() )
{
for ( size_t i = 0 ; i != this->heat_map.size() ; ++i )
{
diff --git a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_intervals.h b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_intervals.h
index 3bd98835..c320b72d 100644
--- a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_intervals.h
+++ b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_intervals.h
@@ -32,7 +32,7 @@
#include <fstream>
#include <vector>
#include <algorithm>
-#include <climits>
+#include <limits>
#include <cmath>
namespace Gudhi
@@ -66,7 +66,7 @@ public:
/**
* This procedure returns x-range of a given persistence diagram.
**/
- std::pair< double , double > give_me_x_range()const
+ std::pair< double , double > get_x_range()const
{
double min_ = std::numeric_limits<int>::max();
double max_ = -std::numeric_limits<int>::max();
@@ -81,7 +81,7 @@ public:
/**
* This procedure returns y-range of a given persistence diagram.
**/
- std::pair< double , double > give_me_y_range()const
+ std::pair< double , double > get_y_range()const
{
double min_ = std::numeric_limits<int>::max();
double max_ = -std::numeric_limits<int>::max();
@@ -156,7 +156,7 @@ public:
/**
* Generating gnuplot script to plot the interval.
**/
- void plot( const char* filename , double min_x = -1 , double max_x = -1 , double min_y = -1 , double max_y = -1 ) const
+ void plot( const char* filename , double min_x = std::numeric_limits<double>::max() , double max_x = std::numeric_limits<double>::max() , double min_y = std::numeric_limits<double>::max() , double max_y = std::numeric_limits<double>::max() ) const
{
//this program create a gnuplot script file that allows to plot persistence diagram.
std::ofstream out;
@@ -164,7 +164,7 @@ public:
std::ostringstream nameSS;
nameSS << filename << "_GnuplotScript";
std::string nameStr = nameSS.str();
- out.open( (char*)nameStr.c_str() );
+ out.open( nameStr );
std::pair<double,double> min_max_values = this->min_max();
if ( min_x == max_x )
diff --git a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape.h b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape.h
index bd41e1bd..26327744 100644
--- a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape.h
+++ b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape.h
@@ -104,7 +104,7 @@ public:
/**
* This function compute integral of the 'level'-level of a landscape.
**/
- double compute_integral_of_landscape( size_t level )const;
+ double compute_integral_of_a_level_of_a_landscape( size_t level )const;
/**
@@ -249,7 +249,7 @@ public:
/**
- * Computations of minimum (y) value of landscape.
+ *\private Computations of minimum (y) value of landscape.
**/
double compute_minimum()const
{
@@ -266,12 +266,12 @@ public:
}
/**
- * Computations of a L^i norm of landscape, where i is the input parameter.
+ *\private Computations of a L^i norm of landscape, where i is the input parameter.
**/
double compute_norm_of_landscape( double i )
{
Persistence_landscape l;
- if ( i != std::numeric_limits< double >::max() )
+ if ( i < std::numeric_limits< double >::max() )
{
return compute_distance_of_landscapes(*this,l,i);
}
@@ -287,14 +287,14 @@ public:
double operator()(unsigned level,double x)const{return this->compute_value_at_a_given_point(level,x);}
/**
- * Computations of L^{\infty} distance between two landscapes.
+ *\private Computations of L^{\infty} distance between two landscapes.
**/
friend double compute_max_norm_distance_of_landscapes( const Persistence_landscape& first, const Persistence_landscape& second );
//friend double compute_max_norm_distance_of_landscapes( const Persistence_landscape& first, const Persistence_landscape& second , unsigned& nrOfLand , double&x , double& y1, double& y2 );
/**
- * Computations of L^{p} distance between two landscapes. p is the parameter of the procedure.
+ *\private Computations of L^{p} distance between two landscapes. p is the parameter of the procedure.
**/
friend double compute_distance_of_landscapes( const Persistence_landscape& first, const Persistence_landscape& second , double p );
@@ -317,7 +317,7 @@ public:
double find_max( unsigned lambda )const;
/**
- * Function to compute inner (scalar) product of two landscapes.
+ *\private Function to compute inner (scalar) product of two landscapes.
**/
friend double compute_inner_product( const Persistence_landscape& l1 , const Persistence_landscape& l2 );
@@ -343,7 +343,7 @@ public:
**/
double project_to_R( int number_of_function )const
{
- return this->compute_integral_of_landscape( (size_t)number_of_function );
+ return this->compute_integral_of_a_level_of_a_landscape( (size_t)number_of_function );
}
/**
@@ -443,7 +443,7 @@ public:
**/
double distance( const Persistence_landscape& second , double power = 1 )const
{
- if ( power != std::numeric_limits<double>::max() )
+ if ( power < std::numeric_limits<double>::max() )
{
return compute_distance_of_landscapes( *this , second , power );
}
@@ -470,7 +470,7 @@ public:
* This procedure returns x-range of a given level persistence landscape. If a default value is used, the x-range
* of 0th level landscape is given (and this range contains the ranges of all other landscapes).
**/
- std::pair< double , double > give_me_x_range( size_t level = 0 )const
+ std::pair< double , double > get_x_range( size_t level = 0 )const
{
std::pair< double , double > result;
if ( level < this->land.size() )
@@ -488,7 +488,7 @@ public:
* This procedure returns y-range of a given level persistence landscape. If a default value is used, the y-range
* of 0th level landscape is given (and this range contains the ranges of all other landscapes).
**/
- std::pair< double , double > give_me_y_range( size_t level = 0 )const
+ std::pair< double , double > get_y_range( size_t level = 0 )const
{
std::pair< double , double > result;
if ( level < this->land.size() )
@@ -504,31 +504,12 @@ public:
return result;
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- std::vector< std::vector< std::pair<double,double> > > output_for_visualization()
- {
- return this->land;
- }
//a function used to create a gnuplot script for visualization of landscapes
- void plot( const char* filename, double xRangeBegin = -1 , double xRangeEnd = -1 , double yRangeBegin = -1 , double yRangeEnd = -1,int from = -1, int to = -1 );
+ void plot( const char* filename, double xRangeBegin = std::numeric_limits<double>::max() , double xRangeEnd = std::numeric_limits<double>::max() ,
+ double yRangeBegin = std::numeric_limits<double>::max() , double yRangeEnd = std::numeric_limits<double>::max(),
+ int from = std::numeric_limits<int>::max(), int to = std::numeric_limits<int>::max() );
protected:
@@ -788,7 +769,7 @@ double Persistence_landscape::compute_integral_of_landscape()const
return result;
}
-double Persistence_landscape::compute_integral_of_landscape( size_t level )const
+double Persistence_landscape::compute_integral_of_a_level_of_a_landscape( size_t level )const
{
double result = 0;
if ( level >= this->land.size() )
@@ -1308,7 +1289,7 @@ double compute_distance_of_landscapes( const Persistence_landscape& first, const
if ( dbg ){std::cerr << "Abs of difference ; " << lan << std::endl;getchar();}
- if ( p != std::numeric_limits<double>::max() )
+ if ( p < std::numeric_limits<double>::max() )
{
//\int_{- \infty}^{+\infty}| first-second |^p
double result;
@@ -1467,16 +1448,16 @@ void Persistence_landscape::plot( const char* filename, double xRangeBegin , do
std::ostringstream nameSS;
nameSS << filename << "_GnuplotScript";
std::string nameStr = nameSS.str();
- out.open( (char*)nameStr.c_str() );
+ out.open( nameStr );
- if ( (xRangeBegin != -1) || (xRangeEnd != -1) || (yRangeBegin != -1) || (yRangeEnd != -1) )
+ if ( (xRangeBegin != std::numeric_limits<double>::max()) || (xRangeEnd != std::numeric_limits<double>::max()) || (yRangeBegin != std::numeric_limits<double>::max()) || (yRangeEnd != std::numeric_limits<double>::max()) )
{
out << "set xrange [" << xRangeBegin << " : " << xRangeEnd << "]" << std::endl;
out << "set yrange [" << yRangeBegin << " : " << yRangeEnd << "]" << std::endl;
}
- if ( from == -1 ){from = 0;}
- if ( to == -1 ){to = this->land.size();}
+ if ( from == std::numeric_limits<int>::max() ){from = 0;}
+ if ( to == std::numeric_limits<int>::max() ){to = this->land.size();}
out << "plot ";
for ( size_t lambda= std::min((size_t)from,this->land.size()) ; lambda != std::min((size_t)to,this->land.size()) ; ++lambda )
diff --git a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape_on_grid.h b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape_on_grid.h
index be60f858..08b93a0a 100644
--- a/src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape_on_grid.h
+++ b/src/Gudhi_stat/include/gudhi/concretizations/Persistence_landscape_on_grid.h
@@ -502,7 +502,7 @@ public:
* This procedure returns x-range of a given level persistence landscape. If a default value is used, the x-range
* of 0th level landscape is given (and this range contains the ranges of all other landscapes).
**/
- std::pair< double , double > give_me_x_range( size_t level = 0 )const
+ std::pair< double , double > get_x_range( size_t level = 0 )const
{
return std::make_pair( this->grid_min , this->grid_max );
//std::pair< double , double > result;
@@ -533,7 +533,7 @@ public:
* This procedure returns y-range of a persistence landscape. If a default value is used, the y-range
* of 0th level landscape is given (and this range contains the ranges of all other landscapes).
**/
- std::pair< double , double > give_me_y_range( size_t level = 0 )const
+ std::pair< double , double > get_y_range( size_t level = 0 )const
{
return this->compute_minimum_maximum();
//std::pair< double , double > result;
@@ -569,7 +569,7 @@ public:
std::vector< std::pair< double , double > > p;
Persistence_landscape_on_grid l(p,this->grid_min,this->grid_max,this->values_of_landscapes.size()-1);
- if ( i != std::numeric_limits<double>::max() )
+ if ( i < std::numeric_limits<double>::max() )
{
return compute_distance_of_landscapes_on_grid(*this,l,i);
}
@@ -762,7 +762,7 @@ public:
std::cerr << "Abs : " << lan << std::endl;
}
- if ( p != std::numeric_limits< double >::max() )
+ if ( p < std::numeric_limits< double >::max() )
{
//\int_{- \infty}^{+\infty}| first-second |^p
double result;
@@ -941,7 +941,7 @@ public:
**/
double distance( const Persistence_landscape_on_grid& second , double power = 1 )const
{
- if ( power != std::numeric_limits<double>::max() )
+ if ( power < std::numeric_limits<double>::max() )
{
return compute_distance_of_landscapes_on_grid( *this , second , power );
}
@@ -995,13 +995,13 @@ public:
**/
void plot( const char* filename , size_t from_ , size_t to_ )const
{
- this->plot( filename , -1 , -1 , -1 , -1 , from_ , to_ );
+ this->plot( filename , std::numeric_limits<double>::max() , std::numeric_limits<double>::max(), std::numeric_limits<double>::max() , std::numeric_limits<double>::max() , from_ , to_ );
}
/**
* function used to create a gnuplot script for visualization of landscapes. Over here we can restrict also x and y range of the landscape.
**/
- void plot( const char* filename, double min_x = -1 , double max_x = -1 , double min_y = -1 , double max_y = -1 , size_t from_ = std::numeric_limits<size_t>::max(), size_t to_= std::numeric_limits<size_t>::max() )const;
+ void plot( const char* filename, double min_x = std::numeric_limits<double>::max() , double max_x = std::numeric_limits<double>::max() , double min_y = std::numeric_limits<double>::max() , double max_y = std::numeric_limits<double>::max() , size_t from_ = std::numeric_limits<size_t>::max(), size_t to_= std::numeric_limits<size_t>::max() )const;
protected:
@@ -1197,7 +1197,7 @@ void Persistence_landscape_on_grid::plot( const char* filename, double min_x , d
std::ostringstream nameSS;
nameSS << filename << "_GnuplotScript";
std::string nameStr = nameSS.str();
- out.open( (char*)nameStr.c_str() );
+ out.open( nameStr );
if ( min_x == max_x )
{
diff --git a/src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h b/src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h
index dc1df0c6..d44fa862 100644
--- a/src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h
+++ b/src/Gudhi_stat/include/gudhi/concretizations/Vector_distances_in_diagram.h
@@ -263,7 +263,7 @@ public:
/**
* The x-range of the persistence vector.
**/
- std::pair< double , double > give_me_x_range()const
+ std::pair< double , double > get_x_range()const
{
return std::make_pair( 0 , this->sorted_vector_of_distances.size() );
}
@@ -271,7 +271,7 @@ public:
/**
* The y-range of the persistence vector.
**/
- std::pair< double , double > give_me_y_range()const
+ std::pair< double , double > get_y_range()const
{
if ( this->sorted_vector_of_distances.size() == 0 )return std::make_pair(0,0);
return std::make_pair( this->sorted_vector_of_distances[0] , 0);
@@ -655,7 +655,7 @@ double Vector_distances_in_diagram<F>::distance( const Vector_distances_in_diagr
}
else
{
- if ( power != std::numeric_limits<double>::max() )
+ if ( power < std::numeric_limits<double>::max() )
{
result += std::pow( fabs( this->sorted_vector_of_distances[i] - second_.sorted_vector_of_distances[i] ) , power );
}
diff --git a/src/Gudhi_stat/include/gudhi/topological_process.h b/src/Gudhi_stat/include/gudhi/topological_process.h
index 0cd8670a..3b3f60e2 100644
--- a/src/Gudhi_stat/include/gudhi/topological_process.h
+++ b/src/Gudhi_stat/include/gudhi/topological_process.h
@@ -30,6 +30,7 @@
#include <gudhi/concretizations/Persistence_landscape_on_grid.h>
#include <gudhi/concretizations/Persistence_heat_maps.h>
#include <vector>
+#include <limits>
//extras
#include <gudhi/common_gudhi_stat.h>
@@ -163,7 +164,7 @@ std::vector< Representation* > construct_representation_from_file( const std::ve
std::vector< std::vector<double> > filter = create_Gaussian_filter(5,1),
bool erase_below_diagonal = false ,
size_t number_of_pixels = 1000 ,
- double min_ = -1 , double max_ = -1 )
+ double min_ = std::numeric_limits<double>::max() , double max_ = std::numeric_limits<double>::max() )
{
std::vector< Representation* > result( intervals_from_file.size() );
for ( size_t i = 0 ; i != intervals_from_file.size() ; ++i )
@@ -265,26 +266,26 @@ public:
}
}
- std::pair< double , double > give_me_x_range()const
+ std::pair< double , double > get_x_range()const
{
double min_x = std::numeric_limits< double >::max();
double max_x = -std::numeric_limits< double >::max();
for ( size_t i = 0 ; i != this->data.size() ; ++i )
{
- std::pair< double , double > xrange = this->data[i]->give_me_x_range();
+ std::pair< double , double > xrange = this->data[i]->get_x_range();
if ( min_x > xrange.first )min_x = xrange.first;
if ( max_x < xrange.second )max_x = xrange.second;
}
return std::make_pair( min_x , max_x );
}
- std::pair< double , double > give_me_y_range()const
+ std::pair< double , double > get_y_range()const
{
double min_y = std::numeric_limits< double >::max();
double max_y = -std::numeric_limits< double >::max();
for ( size_t i = 0 ; i != this->data.size() ; ++i )
{
- std::pair< double , double > yrange = this->data[i]->give_me_y_range();
+ std::pair< double , double > yrange = this->data[i]->get_y_range();
if ( min_y > yrange.first )min_y = yrange.first;
if ( max_y < yrange.second )max_y = yrange.second;
}
@@ -297,11 +298,11 @@ public:
bool are_the_data_aligned()const
{
if ( this->data.size() == 0 )return true;//empty collection is aligned
- std::pair< double , double > x_range = this->data[0]->give_me_x_range();
- std::pair< double , double > y_range = this->data[0]->give_me_y_range();
+ std::pair< double , double > x_range = this->data[0]->get_x_range();
+ std::pair< double , double > y_range = this->data[0]->get_y_range();
for ( size_t i = 1 ; i != this->data.size() ; ++i )
{
- if ( (x_range != this->data[i]->give_me_x_range()) || (y_range != this->data[i]->give_me_y_range()) )
+ if ( (x_range != this->data[i]->get_x_range()) || (y_range != this->data[i]->get_y_range()) )
{
return false;
}
@@ -313,7 +314,7 @@ public:
//scalar products?
//confidence bounds?
- void plot( const char* filename , size_t delay = 30 , double min_x = -1 , double max_x = -1 , double min_y = -1 , double max_y = -1 )
+ void plot( const char* filename , size_t delay = 30 , double min_x = std::numeric_limits<double>::max() , double max_x = std::numeric_limits<double>::max() , double min_y = std::numeric_limits<double>::max() , double max_y = std::numeric_limits<double>::max() )
{
std::vector< std::string > filenames;
//over here we need to
@@ -362,7 +363,7 @@ public:
}//plot
- std::vector< Representation* > give_me_data(){return this->data;}
+ std::vector< Representation* > get_data(){return this->data;}
private:
std::vector< Representation* > data;
};
diff --git a/src/Gudhi_stat/test/persistence_lanscapes_test.cpp b/src/Gudhi_stat/test/persistence_lanscapes_test.cpp
index d0a29588..30ebdba3 100644
--- a/src/Gudhi_stat/test/persistence_lanscapes_test.cpp
+++ b/src/Gudhi_stat/test/persistence_lanscapes_test.cpp
@@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE(check_computations_of_integrals_for_each_level_separatelly)
for ( size_t level = 0 ; level != p.size() ; ++level )
{
- double integral = p.compute_integral_of_landscape( level );
+ double integral = p.compute_integral_of_a_level_of_a_landscape( level );
BOOST_CHECK( fabs( integral - integrals_fir_different_levels[level] ) <= 0.00001 );
}
@@ -110,16 +110,16 @@ BOOST_AUTO_TEST_CASE(check_computations_of_integrals_of_powers_of_landscape)
Persistence_landscape p( "data/file_with_diagram" );
std::vector<double> integrals_fir_different_powers;
- integrals_fir_different_powers.push_back( 0.216432 );
- integrals_fir_different_powers.push_back( 0.204763 );
- integrals_fir_different_powers.push_back( 0.188793 );
- integrals_fir_different_powers.push_back( 0.178856 );
- integrals_fir_different_powers.push_back( 0.163142 );
+ integrals_fir_different_powers.push_back( 17.1692 );
+ integrals_fir_different_powers.push_back( 2.34992 );
+ integrals_fir_different_powers.push_back( 0.49857 );
+ integrals_fir_different_powers.push_back( 0.126405 );
+ integrals_fir_different_powers.push_back( 0.0355235 );
for ( size_t power = 0 ; power != 5 ; ++power )
{
- double integral = p.compute_integral_of_landscape( power );
- BOOST_CHECK( fabs( integral - integrals_fir_different_powers[power] ) <= 0.00001 );
+ double integral = p.compute_integral_of_landscape( (double)power );
+ BOOST_CHECK( fabs( integral - integrals_fir_different_powers[power] ) <= 0.00005 );
}
}