65 bool iscomplex =
false;
67 bool isvector =
false;
68 bool success = Eigen::getMarketHeader(filename, sym, iscomplex, isvector);
70 throw std::runtime_error(
"Could not read " + filename);
73 throw std::runtime_error(
"Only supports reading in general matrices");
76 throw std::runtime_error(
77 "Only supports reading in matrices with real numbers");
81 throw std::runtime_error(
82 "Use the eigen method `loadMarket` for sparse data");
85 std::ifstream in(filename, std::ios::in);
87 throw std::runtime_error(
"Could not open " + filename);
94 std::getline(in, line);
96 }
while (line[0] ==
'%');
97 std::istringstream newline(line);
98 newline >> rows >> cols;
99 assert(rows > 0 && cols > 0);
102 Index n = rows * cols;
103 std::vector<double> entries;
106 while (std::getline(in, line) && (i < n)) {
107 std::istringstream newline2(line);
109 entries.push_back(value);
114 return Eigen::Map<Eigen::MatrixXd>(entries.data(), rows, cols);