diff options
author | pdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-04-13 20:09:43 +0000 |
---|---|---|
committer | pdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-04-13 20:09:43 +0000 |
commit | 564deeab5f8c3b6251016e08cbecf1c47c7f5610 (patch) | |
tree | cb5d10e38ec762a27d6b4816e1f0321bc59d95c4 /src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_intervals.h | |
parent | aecf253b150fcaf0a9e2a41686de7dfea91fa4d8 (diff) |
Answer to Marc's comments (MG5)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/gudhi_stat@2344 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 5d2cd22cb13d74b1ca99892eb8773d8db2e7db2b
Diffstat (limited to 'src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_intervals.h')
-rw-r--r-- | src/Gudhi_stat/include/gudhi/persistence_representations/Persistence_intervals.h | 28 |
1 files changed, 9 insertions, 19 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; |