From 3a76dcb9f49671b01ae200a13569f47fca57dac0 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Wed, 31 May 2017 06:20:04 +0000 Subject: Fix cpplint and cppcheck git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/persistence_representation_integration@2480 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 9ad6fc7b096fff02a8696515c074ddd92980a8e2 --- .../example/persistence_heat_maps.cpp | 1 + .../example/persistence_intervals.cpp | 2 + .../example/persistence_landscape.cpp | 6 ++- .../example/persistence_landscape_on_grid.cpp | 6 ++- .../example/persistence_vectors.cpp | 6 ++- .../include/gudhi/PSSK.h | 9 +++-- .../include/gudhi/Persistence_heat_maps.h | 33 ++++++++-------- .../include/gudhi/Persistence_intervals.h | 7 ++-- .../gudhi/Persistence_intervals_with_distances.h | 4 +- .../include/gudhi/Persistence_landscape.h | 37 +++++++++--------- .../include/gudhi/Persistence_landscape_on_grid.h | 44 +++++++++++----------- .../include/gudhi/Persistence_vectors.h | 18 +++++---- .../gudhi/common_persistence_representations.h | 3 ++ .../include/gudhi/read_persistence_from_file.h | 8 ++-- .../average_persistence_heat_maps.cpp | 1 + .../compute_distance_of_persistence_heat_maps.cpp | 2 + ...ute_scalar_product_of_persistence_heat_maps.cpp | 1 + ...h_m_weighted_by_arctan_of_their_persistence.cpp | 2 + ...te_p_h_m_weighted_by_distance_from_diagonal.cpp | 2 + ...ate_p_h_m_weighted_by_squared_diag_distance.cpp | 2 + .../create_persistence_heat_maps.cpp | 2 + .../persistence_heat_maps/create_pssk.cpp | 2 + ...te_birth_death_range_in_persistence_diagram.cpp | 1 + .../compute_bottleneck_distance.cpp | 2 + .../compute_number_of_dominant_intervals.cpp | 3 ++ .../plot_histogram_of_intervals_lengths.cpp | 3 ++ .../plot_persistence_Betti_numbers.cpp | 3 ++ .../plot_persistence_intervals.cpp | 3 ++ .../persistence_landscapes/average_landscapes.cpp | 1 + .../compute_distance_of_landscapes.cpp | 1 + .../compute_scalar_product_of_landscapes.cpp | 1 + .../compute_distance_of_landscapes_on_grid.cpp | 2 + ...ompute_scalar_product_of_landscapes_on_grid.cpp | 1 + .../create_landscapes_on_grid.cpp | 4 +- .../average_persistence_vectors.cpp | 1 + .../compute_distance_of_persistence_vectors.cpp | 2 + ...mpute_scalar_product_of_persistence_vectors.cpp | 2 + .../create_persistence_vectors.cpp | 2 + 38 files changed, 149 insertions(+), 81 deletions(-) (limited to 'src/Persistence_representations') diff --git a/src/Persistence_representations/example/persistence_heat_maps.cpp b/src/Persistence_representations/example/persistence_heat_maps.cpp index 5e3be880..a9ac5df5 100644 --- a/src/Persistence_representations/example/persistence_heat_maps.cpp +++ b/src/Persistence_representations/example/persistence_heat_maps.cpp @@ -25,6 +25,7 @@ #include #include +#include using namespace Gudhi; using namespace Gudhi::Persistence_representations; diff --git a/src/Persistence_representations/example/persistence_intervals.cpp b/src/Persistence_representations/example/persistence_intervals.cpp index 1accfb0c..29cd66f3 100644 --- a/src/Persistence_representations/example/persistence_intervals.cpp +++ b/src/Persistence_representations/example/persistence_intervals.cpp @@ -24,6 +24,8 @@ #include #include +#include +#include using namespace Gudhi; using namespace Gudhi::Persistence_representations; diff --git a/src/Persistence_representations/example/persistence_landscape.cpp b/src/Persistence_representations/example/persistence_landscape.cpp index 4225f83a..1bcc524a 100644 --- a/src/Persistence_representations/example/persistence_landscape.cpp +++ b/src/Persistence_representations/example/persistence_landscape.cpp @@ -22,11 +22,13 @@ #include +#include +#include +#include + using namespace Gudhi; using namespace Gudhi::Persistence_representations; -#include - int main(int argc, char** argv) { // create two simple vectors with birth--death pairs: diff --git a/src/Persistence_representations/example/persistence_landscape_on_grid.cpp b/src/Persistence_representations/example/persistence_landscape_on_grid.cpp index 821fb5b7..0cede07e 100644 --- a/src/Persistence_representations/example/persistence_landscape_on_grid.cpp +++ b/src/Persistence_representations/example/persistence_landscape_on_grid.cpp @@ -22,11 +22,13 @@ #include +#include +#include +#include + using namespace Gudhi; using namespace Gudhi::Persistence_representations; -#include - int main(int argc, char** argv) { // create two simple vectors with birth--death pairs: diff --git a/src/Persistence_representations/example/persistence_vectors.cpp b/src/Persistence_representations/example/persistence_vectors.cpp index bc2f3fe7..c6581039 100644 --- a/src/Persistence_representations/example/persistence_vectors.cpp +++ b/src/Persistence_representations/example/persistence_vectors.cpp @@ -21,12 +21,14 @@ */ #include -#include - #include + +#include #include #include #include +#include +#include using namespace Gudhi; using namespace Gudhi::Persistence_representations; diff --git a/src/Persistence_representations/include/gudhi/PSSK.h b/src/Persistence_representations/include/gudhi/PSSK.h index 59e73af4..53628737 100644 --- a/src/Persistence_representations/include/gudhi/PSSK.h +++ b/src/Persistence_representations/include/gudhi/PSSK.h @@ -26,6 +26,10 @@ // gudhi include #include +#include +#include +#include + namespace Gudhi { namespace Persistence_representations { @@ -117,8 +121,8 @@ void PSSK::construct(const std::vector >& intervals_, for (size_t pt_nr = 0; pt_nr != intervals_.size(); ++pt_nr) { // compute the value of intervals_[pt_nr] in the grid: - int x_grid = (int)((intervals_[pt_nr].first - this->min_) / (this->max_ - this->min_) * number_of_pixels); - int y_grid = (int)((intervals_[pt_nr].second - this->min_) / (this->max_ - this->min_) * number_of_pixels); + int x_grid = static_cast((intervals_[pt_nr].first - this->min_) / (this->max_ - this->min_) * number_of_pixels); + int y_grid = static_cast((intervals_[pt_nr].second - this->min_) / (this->max_ - this->min_) * number_of_pixels); if (dbg) { std::cerr << "point : " << intervals_[pt_nr].first << " , " << intervals_[pt_nr].second << std::endl; @@ -134,7 +138,6 @@ void PSSK::construct(const std::vector >& intervals_, if (dbg) { std::cerr << "After shift : \n"; - ; std::cerr << "x_grid : " << x_grid << std::endl; std::cerr << "y_grid : " << y_grid << std::endl; std::cerr << "filter.size() : " << filter.size() << std::endl; diff --git a/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h b/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h index 549c19e7..5ef5129d 100644 --- a/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h +++ b/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h @@ -23,18 +23,20 @@ #ifndef PERSISTENCE_HEAT_MAPS_H_ #define PERSISTENCE_HEAT_MAPS_H_ +// gudhi include +#include +#include + // standard include #include #include #include #include #include -#include #include - -// gudhi include -#include -#include +#include +#include +#include namespace Gudhi { namespace Persistence_representations { @@ -68,8 +70,8 @@ std::vector > create_Gaussian_filter(size_t pixel_radius, do getchar(); } - for (int x = -pixel_radius; x <= (int)pixel_radius; x++) { - for (int y = -pixel_radius; y <= (int)pixel_radius; y++) { + for (int x = -pixel_radius; x <= static_cast(pixel_radius); x++) { + for (int y = -pixel_radius; y <= static_cast(pixel_radius); y++) { double real_x = 2 * sigma * x / pixel_radius; double real_y = 2 * sigma * y / pixel_radius; r = sqrt(real_x * real_x + real_y * real_y); @@ -123,7 +125,7 @@ class constant_scaling_function { class distance_from_diagonal_scaling { public: double operator()(const std::pair& point_in_diagram) { - //(point_in_diagram.first+point_in_diagram.second)/2.0 + // (point_in_diagram.first+point_in_diagram.second)/2.0 return sqrt(pow((point_in_diagram.first - (point_in_diagram.first + point_in_diagram.second) / 2.0), 2) + pow((point_in_diagram.second - (point_in_diagram.first + point_in_diagram.second) / 2.0), 2)); } @@ -194,7 +196,7 @@ class Persistence_heat_maps { this->erase_below_diagonal = false; this->min_ = this->max_ = 0; this->set_up_parameters_for_basic_classes(); - }; + } /** * Construction that takes at the input the following parameters: @@ -580,8 +582,8 @@ void Persistence_heat_maps::construct(const std::vectormin_) / (this->max_ - this->min_) * number_of_pixels); - int y_grid = (int)((intervals_[pt_nr].second - this->min_) / (this->max_ - this->min_) * number_of_pixels); + int x_grid = static_cast((intervals_[pt_nr].first - this->min_) / (this->max_ - this->min_) * number_of_pixels); + int y_grid = static_cast((intervals_[pt_nr].second - this->min_) / (this->max_ - this->min_) * number_of_pixels); if (dbg) { std::cerr << "point : " << intervals_[pt_nr].first << " , " << intervals_[pt_nr].second << std::endl; @@ -597,7 +599,6 @@ void Persistence_heat_maps::construct(const std::vector::compute_mean(const std::vector< for (size_t map_no = 0; map_no != maps.size(); ++map_no) { mean += maps[map_no]->heat_map[i][j]; } - heat_maps[i][j] = mean / (double)maps.size(); + heat_maps[i][j] = mean / static_cast(maps.size()); } } this->heat_map = heat_maps; @@ -782,7 +783,7 @@ void Persistence_heat_maps::load_from_file(const char* file // checking if the file exist / if it was open. 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"; + throw "The persistence landscape file do not exist. The program will now terminate \n"; } // now we read the file one by one. @@ -848,7 +849,7 @@ double Persistence_heat_maps::distance(const Persistence_he if (!this->check_if_the_same(second)) { std::cerr << "The persistence images are of non compatible sizes. We cannot therefore compute distance between " "them. The program will now terminate"; - throw "The persistence images are of non compatible sizes. We cannot therefore compute distance between them. The program will now terminate"; + throw "The persistence images are of non compatible sizes. The program will now terminate"; } // if we are here, we know that the two persistence images are defined on the same domain, so we can start computing @@ -897,7 +898,7 @@ double Persistence_heat_maps::compute_scalar_product(const if (!this->check_if_the_same(second)) { std::cerr << "The persistence images are of non compatible sizes. We cannot therefore compute distance between " "them. The program will now terminate"; - throw "The persistence images are of non compatible sizes. We cannot therefore compute distance between them. The program will now terminate"; + throw "The persistence images are of non compatible sizes. The program will now terminate"; } // if we are here, we know that the two persistence images are defined on the same domain, so we can start computing diff --git a/src/Persistence_representations/include/gudhi/Persistence_intervals.h b/src/Persistence_representations/include/gudhi/Persistence_intervals.h index 939ae274..9e614efd 100644 --- a/src/Persistence_representations/include/gudhi/Persistence_intervals.h +++ b/src/Persistence_representations/include/gudhi/Persistence_intervals.h @@ -32,9 +32,10 @@ #include #include #include -#include #include #include +#include +#include namespace Gudhi { namespace Persistence_representations { @@ -402,7 +403,7 @@ std::vector Persistence_intervals::characteristic_function_of_diagram(do for (size_t pos = beginIt; pos != endIt; ++pos) { result[pos] += - ((x_max - x_min) / (double)number_of_bins) * (this->intervals[i].second - this->intervals[i].first); + ((x_max - x_min) / static_cast(number_of_bins)) * (this->intervals[i].second - this->intervals[i].first); } if (dbg) { std::cerr << "Result at this stage \n"; @@ -564,6 +565,6 @@ double Persistence_intervals::project_to_R(int number_of_function) const { } } // namespace Persistence_representations -} // namespace gudhi +} // namespace Gudhi #endif // PERSISTENCE_INTERVALS_H_ diff --git a/src/Persistence_representations/include/gudhi/Persistence_intervals_with_distances.h b/src/Persistence_representations/include/gudhi/Persistence_intervals_with_distances.h index 0f3920cd..e476d28a 100644 --- a/src/Persistence_representations/include/gudhi/Persistence_intervals_with_distances.h +++ b/src/Persistence_representations/include/gudhi/Persistence_intervals_with_distances.h @@ -26,6 +26,8 @@ #include #include +#include + namespace Gudhi { namespace Persistence_representations { @@ -56,6 +58,6 @@ class Persistence_intervals_with_distances : public Persistence_intervals { }; } // namespace Persistence_representations -} // namespace gudhi +} // namespace Gudhi #endif // PERSISTENCE_INTERVALS_WITH_DISTANCES_H_ diff --git a/src/Persistence_representations/include/gudhi/Persistence_landscape.h b/src/Persistence_representations/include/gudhi/Persistence_landscape.h index be7c9e31..c86e68d3 100644 --- a/src/Persistence_representations/include/gudhi/Persistence_landscape.h +++ b/src/Persistence_representations/include/gudhi/Persistence_landscape.h @@ -23,6 +23,10 @@ #ifndef PERSISTENCE_LANDSCAPE_H_ #define PERSISTENCE_LANDSCAPE_H_ +// gudhi include +#include +#include + // standard include #include #include @@ -31,10 +35,9 @@ #include #include #include - -// gudhi include -#include -#include +#include +#include +#include namespace Gudhi { namespace Persistence_representations { @@ -323,7 +326,7 @@ class Persistence_landscape { * Vectorized_topological_data */ std::vector vectorize(int number_of_function) const { - // TODO, think of something smarter over here + // TODO(PD) think of something smarter over here std::vector v; if ((size_t)number_of_function > this->land.size()) { return v; @@ -393,7 +396,7 @@ class Persistence_landscape { nextLevelMerge.swap(nextNextLevelMerge); } (*this) = (*nextLevelMerge[0]); - (*this) *= 1 / ((double)to_average.size()); + (*this) *= 1 / static_cast(to_average.size()); } /** @@ -882,7 +885,7 @@ void Persistence_landscape::load_landscape_from_file(const char* filename) { 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"; + throw "The persistence landscape file do not exist. The program will now terminate \n"; } std::string line; @@ -971,7 +974,7 @@ Persistence_landscape operation_on_pair_of_landscapes(const Persistence_landscap } lambda_n.push_back( std::make_pair(land1.land[i][p].first, - oper((double)land1.land[i][p].second, + oper(static_cast(land1.land[i][p].second), function_value(land2.land[i][q - 1], land2.land[i][q], land1.land[i][p].first)))); ++p; continue; @@ -1085,8 +1088,8 @@ double compute_maximal_distance_non_symmetric(const Persistence_landscape& pl1, } int p2Count = 0; - for (size_t i = 1; i != pl1.land[level].size() - 1; ++i) // In this case, I consider points at the infinity - { + // In this case, I consider points at the infinity + for (size_t i = 1; i != pl1.land[level].size() - 1; ++i) { while (true) { if ((pl1.land[level][i].first >= pl2.land[level][p2Count].first) && (pl1.land[level][i].first <= pl2.land[level][p2Count + 1].first)) @@ -1142,17 +1145,17 @@ double compute_distance_of_landscapes(const Persistence_landscape& first, const } if (p < std::numeric_limits::max()) { - //\int_{- \infty}^{+\infty}| first-second |^p + // \int_{- \infty}^{+\infty}| first-second |^p double result; if (p != 1) { if (dbg) std::cerr << "Power != 1, compute integral to the power p\n"; - result = lan.compute_integral_of_landscape((double)p); + result = lan.compute_integral_of_landscape(p); } else { if (dbg) std::cerr << "Power = 1, compute integral \n"; result = lan.compute_integral_of_landscape(); } - //(\int_{- \infty}^{+\infty}| first-second |^p)^(1/p) - return pow(result, 1 / (double)p); + // (\int_{- \infty}^{+\infty}| first-second |^p)^(1/p) + return pow(result, 1.0 / p); } else { // p == infty if (dbg) std::cerr << "Power = infty, compute maximum \n"; @@ -1232,9 +1235,9 @@ double compute_inner_product(const Persistence_landscape& l1, const Persistence_ } // we have two intervals in which functions are constant: - //[l1.land[level][l1It].first , l1.land[level][l1It+1].first] + // [l1.land[level][l1It].first , l1.land[level][l1It+1].first] // and - //[l2.land[level][l2It].first , l2.land[level][l2It+1].first] + // [l2.land[level][l2It].first , l2.land[level][l2It+1].first] // We also have an interval [x1,x2]. Since the intervals in the landscapes cover the whole R, then it is clear // that x2 // is either l1.land[level][l1It+1].first of l2.land[level][l2It+1].first or both. Lets test it. @@ -1316,6 +1319,6 @@ void Persistence_landscape::plot(const char* filename, double xRangeBegin, doubl } } // namespace Persistence_representations -} // namespace gudhi +} // namespace Gudhi #endif // PERSISTENCE_LANDSCAPE_H_ diff --git a/src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h b/src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h index bea98f74..6eec26d6 100644 --- a/src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h +++ b/src/Persistence_representations/include/gudhi/Persistence_landscape_on_grid.h @@ -24,6 +24,10 @@ #ifndef PERSISTENCE_LANDSCAPE_ON_GRID_H_ #define PERSISTENCE_LANDSCAPE_ON_GRID_H_ +// gudhi include +#include +#include + // standard include #include #include @@ -32,14 +36,9 @@ #include #include #include -#include -#include #include - -// gudhi include - -#include -#include +#include +#include namespace Gudhi { namespace Persistence_representations { @@ -165,7 +164,7 @@ class Persistence_landscape_on_grid { double compute_integral_of_landscape(size_t level) const { bool dbg = false; double result = 0; - double dx = (this->grid_max - this->grid_min) / (double)(this->values_of_landscapes.size() - 1); + double dx = (this->grid_max - this->grid_min) / static_cast(this->values_of_landscapes.size() - 1); if (dbg) { std::cerr << "this->grid_max : " << this->grid_max << std::endl; @@ -220,7 +219,7 @@ class Persistence_landscape_on_grid { bool dbg = false; double result = 0; - double dx = (this->grid_max - this->grid_min) / (double)(this->values_of_landscapes.size() - 1); + double dx = (this->grid_max - this->grid_min) / static_cast(this->values_of_landscapes.size() - 1); double previous_x = this->grid_min; double previous_y = 0; if (this->values_of_landscapes[0].size() > level) previous_y = this->values_of_landscapes[0][level]; @@ -279,7 +278,7 @@ class Persistence_landscape_on_grid { * Shall those points be joined with lines, we will obtain the i-th landscape function. **/ friend std::ostream& operator<<(std::ostream& out, const Persistence_landscape_on_grid& land) { - double dx = (land.grid_max - land.grid_min) / (double)(land.values_of_landscapes.size() - 1); + double dx = (land.grid_max - land.grid_min) / static_cast(land.values_of_landscapes.size() - 1); double x = land.grid_min; for (size_t i = 0; i != land.values_of_landscapes.size(); ++i) { out << x << " : "; @@ -306,7 +305,7 @@ class Persistence_landscape_on_grid { if ((x < this->grid_min) || (x > this->grid_max)) return 0; // find a position of a vector closest to x: - double dx = (this->grid_max - this->grid_min) / (double)(this->values_of_landscapes.size() - 1); + double dx = (this->grid_max - this->grid_min) / static_cast(this->values_of_landscapes.size() - 1); size_t position = size_t((x - this->grid_min) / dx); if (dbg) { @@ -338,7 +337,6 @@ class Persistence_landscape_on_grid { std::make_pair(position * dx + this->grid_min, this->values_of_landscapes[position][level]), std::make_pair((position + 1) * dx + this->grid_min, 0)); } else { - //(this->values_of_landscapes[position+1].size() > level) line = compute_parameters_of_a_line( std::make_pair(position * dx + this->grid_min, 0), std::make_pair((position + 1) * dx + this->grid_min, this->values_of_landscapes[position + 1][level])); @@ -623,7 +621,7 @@ class Persistence_landscape_on_grid { throw "Landscapes are not defined on the same grid, the program will now terminate"; double result = 0; - double dx = (l1.grid_max - l1.grid_min) / (double)(l1.values_of_landscapes.size() - 1); + double dx = (l1.grid_max - l1.grid_min) / static_cast(l1.values_of_landscapes.size() - 1); double previous_x = l1.grid_min - dx; double previous_y_l1 = 0; @@ -737,14 +735,14 @@ class Persistence_landscape_on_grid { } if (p < std::numeric_limits::max()) { - //\int_{- \infty}^{+\infty}| first-second |^p + // \int_{- \infty}^{+\infty}| first-second |^p double result; if (p != 1) { if (dbg) { std::cerr << "p : " << p << std::endl; getchar(); } - result = lan.compute_integral_of_landscape((double)p); + result = lan.compute_integral_of_landscape(p); if (dbg) { std::cerr << "integral : " << result << std::endl; getchar(); @@ -756,8 +754,8 @@ class Persistence_landscape_on_grid { getchar(); } } - //(\int_{- \infty}^{+\infty}| first-second |^p)^(1/p) - return pow(result, 1 / (double)p); + // (\int_{- \infty}^{+\infty}| first-second |^p)^(1/p) + return pow(result, 1.0 / p); } else { // p == infty return lan.compute_maximum(); @@ -789,7 +787,7 @@ class Persistence_landscape_on_grid { * Vectorized_topological_data */ std::vector vectorize(int number_of_function) const { - // TODO, think of something smarter over here + // TODO(PD) think of something smarter over here if ((number_of_function < 0) || ((size_t)number_of_function >= this->values_of_landscapes.size())) { throw "Wrong number of function\n"; } @@ -864,7 +862,7 @@ class Persistence_landscape_on_grid { } // normalizing: for (size_t i = 0; i != this->values_of_landscapes[grid_point].size(); ++i) { - this->values_of_landscapes[grid_point][i] /= (double)to_average.size(); + this->values_of_landscapes[grid_point][i] /= static_cast(to_average.size()); } } } // compute_average @@ -979,10 +977,10 @@ void Persistence_landscape_on_grid::set_up_values_of_landscapes(const std::vecto this->grid_max = grid_max_; if (grid_max_ <= grid_min_) { - throw "Wrong parameters of grid_min and grid_max given to the procedure. The grid have negative, or zero size. The program will now terminate.\n"; + throw "Wrong parameters of grid_min and grid_max given to the procedure. The program will now terminate.\n"; } - double dx = (grid_max_ - grid_min_) / (double)(number_of_points_); + double dx = (grid_max_ - grid_min_) / static_cast(number_of_points_); // for every interval in the diagram: for (size_t int_no = 0; int_no != p.size(); ++int_no) { size_t grid_interval_begin = (p[int_no].first - grid_min_) / dx; @@ -1161,7 +1159,7 @@ void Persistence_landscape_on_grid::load_landscape_from_file(const char* filenam // check if the file exist. 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"; + throw "The persistence landscape file do not exist. The program will now terminate \n"; } size_t number_of_points_in_the_grid = 0; @@ -1223,7 +1221,7 @@ void Persistence_landscape_on_grid::plot(const char* filename, double min_x, dou } size_t number_of_nonzero_levels = this->number_of_nonzero_levels(); - double dx = (this->grid_max - this->grid_min) / ((double)this->values_of_landscapes.size() - 1); + double dx = (this->grid_max - this->grid_min) / static_cast(this->values_of_landscapes.size() - 1); size_t from = 0; if (from_ != std::numeric_limits::max()) { diff --git a/src/Persistence_representations/include/gudhi/Persistence_vectors.h b/src/Persistence_representations/include/gudhi/Persistence_vectors.h index 282c107d..ad4d3c57 100644 --- a/src/Persistence_representations/include/gudhi/Persistence_vectors.h +++ b/src/Persistence_representations/include/gudhi/Persistence_vectors.h @@ -23,17 +23,19 @@ #ifndef PERSISTENCE_VECTORS_H_ #define PERSISTENCE_VECTORS_H_ +// gudhi include +#include +#include +#include + #include #include #include #include #include #include - -// gudhi include -#include -#include -#include +#include +#include namespace Gudhi { namespace Persistence_representations { @@ -66,7 +68,7 @@ class Vector_distances_in_diagram { /** * The default constructor. **/ - Vector_distances_in_diagram(){}; + Vector_distances_in_diagram(){} /** * The constructor that takes as an input a multiset of persistence intervals (given as vector of birth-death @@ -517,7 +519,7 @@ void Vector_distances_in_diagram::compute_average(const std::vector(to_average.size()); } this->sorted_vector_of_distances = av; this->where_to_cut = av.size(); @@ -611,7 +613,7 @@ void Vector_distances_in_diagram::load_from_file(const char* filename) { // check if the file exist. 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"; + throw "The persistence landscape file do not exist. The program will now terminate \n"; } double number; diff --git a/src/Persistence_representations/include/gudhi/common_persistence_representations.h b/src/Persistence_representations/include/gudhi/common_persistence_representations.h index 8f56ad3e..61a3274d 100644 --- a/src/Persistence_representations/include/gudhi/common_persistence_representations.h +++ b/src/Persistence_representations/include/gudhi/common_persistence_representations.h @@ -23,6 +23,9 @@ #ifndef COMMON_PERSISTENCE_REPRESENTATIONS_H_ #define COMMON_PERSISTENCE_REPRESENTATIONS_H_ +#include +#include + namespace Gudhi { namespace Persistence_representations { // this file contain an implementation of some common procedures used in Persistence_representations. diff --git a/src/Persistence_representations/include/gudhi/read_persistence_from_file.h b/src/Persistence_representations/include/gudhi/read_persistence_from_file.h index a5c2b286..ad3d4e83 100644 --- a/src/Persistence_representations/include/gudhi/read_persistence_from_file.h +++ b/src/Persistence_representations/include/gudhi/read_persistence_from_file.h @@ -28,6 +28,8 @@ #include #include #include +#include +#include namespace Gudhi { namespace Persistence_representations { @@ -54,7 +56,7 @@ std::vector > read_persistence_intervals_in_one_dimens // checking if the file exist: 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"; + throw "The persistence landscape file do not exist. The program will now terminate \n"; } std::string line; @@ -85,7 +87,7 @@ std::vector > read_persistence_intervals_in_one_dimens while (ss >> number) { this_line.push_back(number); } - number_of_entries_per_line += (int)this_line.size(); + number_of_entries_per_line += static_cast(this_line.size()); if (dbg) { std::cerr << "number_of_entries_per_line : " << number_of_entries_per_line << ". This number was obtained by analyzing this line : " << line << std::endl; @@ -93,7 +95,7 @@ std::vector > read_persistence_intervals_in_one_dimens if ((number_of_entries_per_line < 2) || (number_of_entries_per_line > 4)) { std::cerr << "The input file you have provided have wrong number of numerical entries per line. The program " "will now terminate. \n"; - throw "The input file you have provided have wrong number of numerical entries per line. The program will now terminate. \n"; + throw "Wrong number of numerical entries per line in the input file. The program will now terminate. \n"; } } // In case there is an 'inf' string in this line, we are dealing with this situation in below. diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp index b0ea3a35..b4e2be89 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/average_persistence_heat_maps.cpp @@ -26,6 +26,7 @@ using namespace Gudhi; using namespace Gudhi::Persistence_representations; #include +#include int main(int argc, char** argv) { std::cout << "This program computes average persistence landscape of persistence landscapes created based on " diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp index f87530d4..56b2d336 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/compute_distance_of_persistence_heat_maps.cpp @@ -27,6 +27,8 @@ using namespace Gudhi::Persistence_representations; #include #include +#include +#include int main(int argc, char** argv) { std::cout << "This program compute distance of persistence heat maps stored in a file (the file needs to be created " diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp index f801d056..ec9482f0 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/compute_scalar_product_of_persistence_heat_maps.cpp @@ -27,6 +27,7 @@ using namespace Gudhi::Persistence_representations; #include #include +#include int main(int argc, char** argv) { std::cout << "This program compute scalar product of persistence landscapes stored in a file (the file needs to be " diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_arctan_of_their_persistence.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_arctan_of_their_persistence.cpp index a127996f..68c75059 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_arctan_of_their_persistence.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_arctan_of_their_persistence.cpp @@ -27,6 +27,8 @@ using namespace Gudhi::Persistence_representations; #include #include +#include +#include int main(int argc, char** argv) { std::cout << "This program creates persistence heat map of diagrams provided as an input. The Gaussian kernels are " diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_distance_from_diagonal.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_distance_from_diagonal.cpp index 371d94a6..a56393a3 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_distance_from_diagonal.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_distance_from_diagonal.cpp @@ -27,6 +27,8 @@ using namespace Gudhi::Persistence_representations; #include #include +#include +#include int main(int argc, char** argv) { std::cout << "This program creates persistence heat map of diagrams provided as an input. The Gaussian kernels are " diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_squared_diag_distance.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_squared_diag_distance.cpp index e2b9abb1..44115329 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_squared_diag_distance.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/create_p_h_m_weighted_by_squared_diag_distance.cpp @@ -27,6 +27,8 @@ using namespace Gudhi::Persistence_representations; #include #include +#include +#include int main(int argc, char** argv) { std::cout << "This program creates persistence heat map of diagrams provided as an input. The Gaussian kernels are " diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp index 03f1641a..ebc82f82 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/create_persistence_heat_maps.cpp @@ -27,6 +27,8 @@ using namespace Gudhi::Persistence_representations; #include #include +#include +#include int main(int argc, char** argv) { std::cout << "This program creates persistence heat map of diagrams provided as an input.\n"; diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/create_pssk.cpp b/src/Persistence_representations/utilities/persistence_heat_maps/create_pssk.cpp index 004fa90e..7b24bb7c 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/create_pssk.cpp +++ b/src/Persistence_representations/utilities/persistence_heat_maps/create_pssk.cpp @@ -27,6 +27,8 @@ using namespace Gudhi::Persistence_representations; #include #include +#include +#include int main(int argc, char** argv) { std::cout << "This program creates PSSK of diagrams provided as an input.\n"; diff --git a/src/Persistence_representations/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp b/src/Persistence_representations/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp index 058677d9..72c56e92 100644 --- a/src/Persistence_representations/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp +++ b/src/Persistence_representations/utilities/persistence_intervals/compute_birth_death_range_in_persistence_diagram.cpp @@ -26,6 +26,7 @@ #include #include #include +#include using namespace Gudhi; using namespace Gudhi::Persistence_representations; diff --git a/src/Persistence_representations/utilities/persistence_intervals/compute_bottleneck_distance.cpp b/src/Persistence_representations/utilities/persistence_intervals/compute_bottleneck_distance.cpp index f1ccda9f..6a872b7a 100644 --- a/src/Persistence_representations/utilities/persistence_intervals/compute_bottleneck_distance.cpp +++ b/src/Persistence_representations/utilities/persistence_intervals/compute_bottleneck_distance.cpp @@ -28,6 +28,8 @@ using namespace Gudhi::Persistence_representations; #include #include +#include +#include int main(int argc, char** argv) { std::cout << "This program compute the bottleneck distance of persistence diagrams stored in a files. \n"; diff --git a/src/Persistence_representations/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp b/src/Persistence_representations/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp index 1f7011e1..5fbbef14 100644 --- a/src/Persistence_representations/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp +++ b/src/Persistence_representations/utilities/persistence_intervals/compute_number_of_dominant_intervals.cpp @@ -24,6 +24,9 @@ #include #include +#include +#include +#include using namespace Gudhi; using namespace Gudhi::Persistence_representations; diff --git a/src/Persistence_representations/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp b/src/Persistence_representations/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp index 6bdb0081..b8f96b60 100644 --- a/src/Persistence_representations/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp +++ b/src/Persistence_representations/utilities/persistence_intervals/plot_histogram_of_intervals_lengths.cpp @@ -24,6 +24,9 @@ #include #include +#include +#include +#include using namespace Gudhi; using namespace Gudhi::Persistence_representations; diff --git a/src/Persistence_representations/utilities/persistence_intervals/plot_persistence_Betti_numbers.cpp b/src/Persistence_representations/utilities/persistence_intervals/plot_persistence_Betti_numbers.cpp index 206745c1..521621b2 100644 --- a/src/Persistence_representations/utilities/persistence_intervals/plot_persistence_Betti_numbers.cpp +++ b/src/Persistence_representations/utilities/persistence_intervals/plot_persistence_Betti_numbers.cpp @@ -24,6 +24,9 @@ #include #include +#include +#include +#include using namespace Gudhi; using namespace Gudhi::Persistence_representations; diff --git a/src/Persistence_representations/utilities/persistence_intervals/plot_persistence_intervals.cpp b/src/Persistence_representations/utilities/persistence_intervals/plot_persistence_intervals.cpp index 971f039e..e76906e9 100644 --- a/src/Persistence_representations/utilities/persistence_intervals/plot_persistence_intervals.cpp +++ b/src/Persistence_representations/utilities/persistence_intervals/plot_persistence_intervals.cpp @@ -25,6 +25,9 @@ #include #include +#include +#include +#include using namespace Gudhi; using namespace Gudhi::Persistence_representations; diff --git a/src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp b/src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp index 1927551d..f885a7a7 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp +++ b/src/Persistence_representations/utilities/persistence_landscapes/average_landscapes.cpp @@ -26,6 +26,7 @@ using namespace Gudhi; using namespace Gudhi::Persistence_representations; #include +#include int main(int argc, char** argv) { std::cout << "This program computes average persistence landscape of persistence landscapes created based on " diff --git a/src/Persistence_representations/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp b/src/Persistence_representations/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp index a4027fa7..7028b98b 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp +++ b/src/Persistence_representations/utilities/persistence_landscapes/compute_distance_of_landscapes.cpp @@ -27,6 +27,7 @@ using namespace Gudhi::Persistence_representations; #include #include +#include int main(int argc, char** argv) { std::cout << "This program compute distance of persistence landscapes stored in a file (the file needs to be created " diff --git a/src/Persistence_representations/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp b/src/Persistence_representations/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp index 95d5a998..76a9d433 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp +++ b/src/Persistence_representations/utilities/persistence_landscapes/compute_scalar_product_of_landscapes.cpp @@ -27,6 +27,7 @@ using namespace Gudhi::Persistence_representations; #include #include +#include int main(int argc, char** argv) { std::cout << "This program compute scalar product of persistence landscapes stored in a file (the file needs to be " diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp index 1ba34762..4694e897 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp +++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_distance_of_landscapes_on_grid.cpp @@ -27,6 +27,8 @@ using namespace Gudhi::Persistence_representations; #include #include +#include +#include int main(int argc, char** argv) { std::cout << "This program compute distance of persistence landscapes on grid stored in a file (the file needs to be " diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp index 4ec9a740..75c33cb1 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp +++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/compute_scalar_product_of_landscapes_on_grid.cpp @@ -27,6 +27,7 @@ using namespace Gudhi::Persistence_representations; #include #include +#include int main(int argc, char** argv) { std::cout << "This program compute scalar product of persistence landscapes on grid stored in a file (the file needs " diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp index 65addbe5..490a1c25 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp +++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/create_landscapes_on_grid.cpp @@ -27,6 +27,8 @@ using namespace Gudhi::Persistence_representations; #include #include +#include +#include int main(int argc, char** argv) { std::cout << "This program creates persistence landscape on grid of diagrams provided as an input.\n"; @@ -66,7 +68,7 @@ int main(int argc, char** argv) { if ((min_ != -1) || (max_ != -1)) { 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. + // (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, dimension); } std::stringstream ss; diff --git a/src/Persistence_representations/utilities/persistence_vectors/average_persistence_vectors.cpp b/src/Persistence_representations/utilities/persistence_vectors/average_persistence_vectors.cpp index 2bfc4a6d..585f2f61 100644 --- a/src/Persistence_representations/utilities/persistence_vectors/average_persistence_vectors.cpp +++ b/src/Persistence_representations/utilities/persistence_vectors/average_persistence_vectors.cpp @@ -26,6 +26,7 @@ using namespace Gudhi; using namespace Gudhi::Persistence_representations; #include +#include int main(int argc, char** argv) { std::cout << "This program computes average persistence vector of persistence vectors created based on persistence " diff --git a/src/Persistence_representations/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp b/src/Persistence_representations/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp index a2e27612..79906262 100644 --- a/src/Persistence_representations/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp +++ b/src/Persistence_representations/utilities/persistence_vectors/compute_distance_of_persistence_vectors.cpp @@ -27,6 +27,8 @@ using namespace Gudhi::Persistence_representations; #include #include +#include +#include int main(int argc, char** argv) { std::cout << "This program compute distance of persistence vectors stored in a file (the file needs to be created " diff --git a/src/Persistence_representations/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp b/src/Persistence_representations/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp index 95f2d2ae..a5916ed8 100644 --- a/src/Persistence_representations/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp +++ b/src/Persistence_representations/utilities/persistence_vectors/compute_scalar_product_of_persistence_vectors.cpp @@ -27,6 +27,8 @@ using namespace Gudhi::Persistence_representations; #include #include +#include +#include int main(int argc, char** argv) { std::cout << "This program compute scalar product of persistence vectors stored in a file (the file needs to be " diff --git a/src/Persistence_representations/utilities/persistence_vectors/create_persistence_vectors.cpp b/src/Persistence_representations/utilities/persistence_vectors/create_persistence_vectors.cpp index 2996f49b..0941308f 100644 --- a/src/Persistence_representations/utilities/persistence_vectors/create_persistence_vectors.cpp +++ b/src/Persistence_representations/utilities/persistence_vectors/create_persistence_vectors.cpp @@ -27,6 +27,8 @@ using namespace Gudhi::Persistence_representations; #include #include +#include +#include int main(int argc, char** argv) { std::cout << "This program creates persistence vectors of diagrams provided as an input. The first parameter of this " -- cgit v1.2.3