From b4dbd8b2fd498cd8a3803c68923949b471bafbf1 Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Wed, 16 Jun 2010 22:23:02 +0000 Subject: [PATCH] Fix ReadMatrix() (it was trying to write to places that don't exist). I think the implementation in fastlib-armadillo is less bizarre and will end up being used here (arma::vec lends itself better to this task than std::vector). Need to merge those branches... --- fastlib/branches/fastlib-stl/fastlib/data/dataset.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fastlib/branches/fastlib-stl/fastlib/data/dataset.cc b/fastlib/branches/fastlib-stl/fastlib/data/dataset.cc index c7a8d70ad5..daed5ed8ce 100644 --- a/fastlib/branches/fastlib-stl/fastlib/data/dataset.cc +++ b/fastlib/branches/fastlib-stl/fastlib/data/dataset.cc @@ -424,12 +424,12 @@ success_t DatasetInfo::ReadMatrix(TextLineReader *reader, Matrix *matrix) const index_t n_points = 0; success_t retval = SUCCESS_PASS; bool is_done; + double *tmp_point = new double[n_features]; - do { - linearized.push_back(n_features); - double *point = &linearized.back(); - retval = ReadPoint(reader, point, &is_done); + retval = ReadPoint(reader, tmp_point, &is_done); + for(int i = 0; i < n_features; i++) + linearized.push_back(tmp_point[i]); n_points++; } while (!is_done && !FAILED(retval));