diff options
Diffstat (limited to 'src/Gudhi_stat/include/gudhi')
2 files changed, 10 insertions, 31 deletions
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 2ff4d7f7..64d8c502 100644 --- a/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_intervals.h +++ b/src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_intervals.h @@ -58,18 +58,20 @@ public: * are smaller or equal the second elements of pairs. **/ Persistence_intervals( const std::vector< std::pair< double,double > >& intervals ); - - /** - * The procedure returns a pair the first element of which is the leftmost end of the interval, and the second element of which is the rightmost end of the interval. - **/ - std::pair<double,double> min_max()const; /** * This procedure returns x-range of a given persistence diagram. **/ std::pair< double , double > get_x_range()const { - return this->min_max(); + double min_ = std::numeric_limits<int>::max(); + double max_ = -std::numeric_limits<int>::max(); + for ( size_t i = 0 ; i != this->intervals.size() ; ++i ) + { + if ( this->intervals[i].first < min_ )min_ = this->intervals[i].first; + if ( this->intervals[i].second > max_ )max_ = this->intervals[i].second; + } + return std::make_pair( min_ , max_ ); } /** @@ -160,7 +162,7 @@ public: std::string nameStr = nameSS.str(); out.open( nameStr ); - std::pair<double,double> min_max_values = this->min_max(); + std::pair<double,double> min_max_values = this->get_x_range(); if ( min_x == max_x ) { out << "set xrange [" << min_max_values.first - 0.1*(min_max_values.second-min_max_values.first) << " : " << min_max_values.second + 0.1*(min_max_values.second-min_max_values.first) << " ]" << std::endl; @@ -676,18 +678,6 @@ std::vector< double > Persistence_intervals::k_n_n( size_t k , size_t where_to_c } -std::pair<double,double> Persistence_intervals::min_max()const -{ - double min_ = std::numeric_limits<int>::max(); - double max_ = -std::numeric_limits<int>::max(); - for ( size_t i = 0 ; i != this->intervals.size() ; ++i ) - { - if ( this->intervals[i].first < min_ )min_ = this->intervals[i].first; - if ( this->intervals[i].second > max_ )max_ = this->intervals[i].second; - } - return std::make_pair( min_ , max_ ); -} - double Persistence_intervals::project_to_R( int number_of_function )const { double result = 0; 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 index 84a95e95..3c1d8a45 100644 --- 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 @@ -35,18 +35,7 @@ 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 ){} + using Persistence_intervals::Persistence_intervals; /** *Computations of distance from the current persistnce diagram to the persistence diagram given as a parameter of this function. |