From 0a984f22f4c90c7a9d45b57187a6db128558d12c Mon Sep 17 00:00:00 2001 From: Ulrich Bauer Date: Tue, 16 Aug 2016 21:12:23 +0200 Subject: fixed csv reader --- ripser.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ripser.cpp b/ripser.cpp index 168a724..6869aff 100644 --- a/ripser.cpp +++ b/ripser.cpp @@ -701,8 +701,11 @@ compressed_lower_distance_matrix read_point_cloud(std::istream& input_stream) { while (std::getline(input_stream, line)) { std::vector 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)); -- cgit v1.2.3