diff options
author | Ulrich Bauer <mail@ulrich-bauer.org> | 2016-08-16 21:12:23 +0200 |
---|---|---|
committer | Ulrich Bauer <mail@ulrich-bauer.org> | 2016-08-16 21:12:23 +0200 |
commit | 0a984f22f4c90c7a9d45b57187a6db128558d12c (patch) | |
tree | d35036247c86f08accf61d12247deb5c6fac6135 | |
parent | 593131f9a55af9f82c7cfd8d272e1bb7eb0322e4 (diff) |
fixed csv reader
-rw-r--r-- | ripser.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -701,8 +701,11 @@ compressed_lower_distance_matrix read_point_cloud(std::istream& input_stream) { while (std::getline(input_stream, line)) { std::vector<value_t> point; std::istringstream s(line); - while (s >> value) point.push_back(value); - if (!point.empty()) points.push_back(point); + while (s >> value) { + point.push_back(value); + s.ignore(); + } + if (!point.empty()) points.push_back(point); assert(point.size() == points.front().size()); } @@ -751,7 +754,10 @@ compressed_lower_distance_matrix read_distance_matrix(std::istream& input_stream value_t value; for (int i = 0; std::getline(input_stream, line); ++i) { std::istringstream s(line); - for (int j = 0; j < i && s >> value; ++j) distances.push_back(value); + for (int j = 0; j < i && s >> value; ++j) { + distances.push_back(value); + s.ignore(); + } } return compressed_lower_distance_matrix(std::move(distances)); |