diff --git a/Makefile b/Makefile index c5616f8..981cdf9 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ CXX = g++ -CXXFLAGS = -O2 -Wall -I/usr/include/eigen2 +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 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