diff options
author | pdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2018-01-07 08:09:22 +0000 |
---|---|---|
committer | pdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2018-01-07 08:09:22 +0000 |
commit | c64433834bdf168975aa7785b03cdcfdd67c6915 (patch) | |
tree | d10c665796767949698976f93c3235fac68e2955 | |
parent | 475518727d33cb0c8086110bd56854365b5de164 (diff) |
reading ug fixed.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/persistence_representations_fix_reading@3114 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: b1476d1db101bc4c7377d9e5e34445ee6cd7cf9a
5 files changed, 10 insertions, 15 deletions
diff --git a/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h b/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h index 04dd78ad..2d4221c0 100644 --- a/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h +++ b/src/Persistence_representations/include/gudhi/Persistence_heat_maps.h @@ -797,8 +797,8 @@ void Persistence_heat_maps<Scalling_of_kernels>::load_from_file(const char* file std::string temp; std::getline(in, temp); - - while (!in.eof()) { + //change + while (in.good()) { std::getline(in, temp); std::stringstream lineSS; lineSS << temp; diff --git a/src/Persistence_representations/include/gudhi/Persistence_landscape.h b/src/Persistence_representations/include/gudhi/Persistence_landscape.h index 5c300112..e8d53cb4 100644 --- a/src/Persistence_representations/include/gudhi/Persistence_landscape.h +++ b/src/Persistence_representations/include/gudhi/Persistence_landscape.h @@ -954,7 +954,8 @@ void Persistence_landscape::load_landscape_from_file(const char* filename) { std::vector<std::pair<double, double> > landscapeAtThisLevel; bool isThisAFirsLine = true; - while (!in.eof()) { + //change + while (in.good()) { getline(in, line); if (!(line.length() == 0 || line[0] == '#')) { std::stringstream lineSS; diff --git a/src/Persistence_representations/include/gudhi/Persistence_vectors.h b/src/Persistence_representations/include/gudhi/Persistence_vectors.h index 0fb49eee..efa61d95 100644 --- a/src/Persistence_representations/include/gudhi/Persistence_vectors.h +++ b/src/Persistence_representations/include/gudhi/Persistence_vectors.h @@ -617,9 +617,8 @@ void Vector_distances_in_diagram<F>::load_from_file(const char* filename) { } double number; - while (true) { - in >> number; - if (in.eof()) break; + //change + while (in >> number) { this->sorted_vector_of_distances.push_back(number); } in.close(); diff --git a/src/Persistence_representations/test/persistence_intervals_test.cpp b/src/Persistence_representations/test/persistence_intervals_test.cpp index 545330c4..8bcd2508 100644 --- a/src/Persistence_representations/test/persistence_intervals_test.cpp +++ b/src/Persistence_representations/test/persistence_intervals_test.cpp @@ -35,8 +35,7 @@ double epsilon = 0.0000005; // cout << "Left most end of the interval : " << min_max_.first << std::endl; // cout << "Right most end of the interval : " << min_max_.second << std::endl; -BOOST_AUTO_TEST_CASE(check_min_max_function) { - std::cerr << "First test \n"; +BOOST_AUTO_TEST_CASE(check_min_max_function) { Persistence_intervals p("data/file_with_diagram"); std::pair<double, double> min_max_ = p.get_x_range(); diff --git a/src/Persistence_representations/test/persistence_lanscapes_test.cpp b/src/Persistence_representations/test/persistence_lanscapes_test.cpp index 81adb6fa..006e5dcf 100644 --- a/src/Persistence_representations/test/persistence_lanscapes_test.cpp +++ b/src/Persistence_representations/test/persistence_lanscapes_test.cpp @@ -216,13 +216,9 @@ BOOST_AUTO_TEST_CASE(check_computations_of_distances) { Persistence_landscape p(diag); std::vector<std::pair<double, double> > diag2 = read_persistence_intervals_in_one_dimension_from_file("data/file_with_diagram_1"); - Persistence_landscape q(diag2); - std::cout << "p.distance(q) = " << p.distance(q) << std::endl; - BOOST_CHECK(fabs(p.distance(q) - 25.5824) <= 0.00005); - std::cout << "p.distance(q, 2) = " << p.distance(q, 2) << std::endl; - BOOST_CHECK(fabs(p.distance(q, 2) - 2.1264) <= 0.0001); - std::cout << "p.distance(q, std::numeric_limits<double>::max()) = " << - p.distance(q, std::numeric_limits<double>::max()) << std::endl; + Persistence_landscape q(diag2); + BOOST_CHECK(fabs(p.distance(q) - 25.5824) <= 0.00005); + BOOST_CHECK(fabs(p.distance(q, 2) - 2.1264) <= 0.0001); BOOST_CHECK(fabs(p.distance(q, std::numeric_limits<double>::max()) - 0.359068) <= 0.00001); } |