From 0edaa915014835814f0236e9cc41502108809825 Mon Sep 17 00:00:00 2001 From: Emmanuel Benazera Date: Wed, 1 Oct 2014 10:27:29 +0200 Subject: [PATCH 1/3] moving to eigen3 + adding debug symbol --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c5616f8..b4fb2b4 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CXX = g++ -CXXFLAGS = -O2 -Wall -I/usr/include/eigen2 +CXXFLAGS = -O4 -Wall -I/usr/include/eigen3 -g LDFLAGS = OBJ = nca.o From 14e6ca7fd3830207861e09f448b2412494642f00 Mon Sep 17 00:00:00 2001 From: Emmanuel Benazera Date: Wed, 1 Oct 2014 10:27:46 +0200 Subject: [PATCH 2/3] fixed crash when reading empty line in dataset --- nca.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/nca.cpp b/nca.cpp index b1c699c..1e42ab4 100644 --- a/nca.cpp +++ b/nca.cpp @@ -46,22 +46,22 @@ int main(int argc, char *argv[]) { int size = -1; while(std::getline(csv_file, s)) { - if(size < 0) size = csv_size(s); - - CsvSplitter tok(s); - Eigen::VectorXd x(size); - int i = 0, pos = 0; - for(CsvSplitter::const_iterator t = tok.begin(); t != tok.end(); ++t) { - if(pos == label_index) { - label.push_back(*t); - } else { - x[i] = std::atof(t->c_str()); - ++i; - } - ++pos; - } - - input.push_back(x); + if(size < 0) size = csv_size(s); + if (s.empty()) + continue; + CsvSplitter tok(s); + Eigen::VectorXd x(size); + int i = 0, pos = 0; + for(CsvSplitter::const_iterator t = tok.begin(); t != tok.end(); ++t) { + if(pos == label_index) { + label.push_back(*t); + } else { + x[i] = std::atof(t->c_str()); + ++i; + } + ++pos; + } + input.push_back(x); } // Test From 555e1f7b28018fa48696c805a5e4d85294848955 Mon Sep 17 00:00:00 2001 From: Emmanuel Benazera Date: Wed, 1 Oct 2014 10:42:30 +0200 Subject: [PATCH 3/3] fixed makefile + activated openmp --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b4fb2b4..981cdf9 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ CXX = g++ -CXXFLAGS = -O4 -Wall -I/usr/include/eigen3 -g +CXXFLAGS = -O4 -Wall -I/usr/include/eigen3 -g -fopenmp LDFLAGS = OBJ = nca.o nca: $(OBJ) - $(CXX) -o $@ $^ $(CXX_FLAGS) $(LDFLAGS) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) clean: rm -f $(OBJ) nca