Macaulay2 Engine
Loading...
Searching...
No Matches

◆ parseMsolveFromString()

BasicPolyList parseMsolveFromString ( std::string contents)

Definition at line 282 of file BasicPolyListParser.cpp.

283{
284 // Read in file
285 // Read in enough of the header to get identifiers
286
287 IdentifierHash idenMap;
288 std::string_view fileView { contents };
289
290 BasicPolyList Fs;
291 while (fileView.size() > 0)
292 {
293 std::string_view thisline = next_line(fileView);
294
295 if (lineContainsVars(thisline))
296 {
297 std::vector<std::string> idenList = readIdentifierList(thisline);
298 /*
299 std::cout << "-- idenList" << std::endl;
300 for (auto& id : idenList)
301 std::cout << id << std::endl;
302 */
303 idenMap = { idenList };
304 continue;
305 }
306
307 if (thisline.size() == 0 or thisline[0] == '#' or thisline[0] == ']')
308 {
309 continue;
310 }
311
312 BasicPoly F;
313 parseBasicPoly(thisline, idenMap, F);
314 Fs.push_back(F);
315 }
316 return Fs;
317}
std::vector< BasicPoly > BasicPolyList
bool lineContainsVars(std::string_view &line)
std::string_view next_line(std::string_view &str)
std::vector< std::string > readIdentifierList(const std::string_view line)
void parseBasicPoly(const std::string_view &str, const IdentifierHash &idenHash, BasicPoly &result)
This version is a potentially faster alternative when reading many polynomials.
Standalone, self-contained polynomial representation independent of any engine Ring — coefficients ar...
Definition BasicPoly.hpp:64
IdentifierHash: used to facilitate parsing of polynomials from strings and files.

References lineContainsVars(), next_line(), parseBasicPoly(), and readIdentifierList().

Referenced by parseMsolveFile(), rawMatrixReadMsolveString(), and TEST().