31 template <
typename MATRIX>
32 void load_csv(
const std::string& path, MATRIX& M)
37 std::vector<typename MATRIX::Scalar> values;
39 while (std::getline(indata, line))
41 if (!line.empty() && line[0] ==
'#')
continue;
42 std::stringstream lineStream(line);
44 while (std::getline(lineStream, cell,
','))
46 std::stringstream cs(cell);
49 values.push_back(
val);
56 MATRIX::ColsAtCompileTime, Eigen::RowMajor>>(
57 values.data(), rows, values.size() / rows);
void load_csv(const std::string &path, MATRIX &M)
Loads a matrix from a CSV text file.