|
Macaulay2 Engine
|
Minimal, portable polynomial value type used where heavier engine types would be overkill. More...
#include "exceptions.hpp"#include <vector>#include <iosfwd>#include <string>#include <unordered_map>#include <gmpxx.h>Go to the source code of this file.
Classes | |
| class | BasicPoly |
| Standalone, self-contained polynomial representation independent of any engine Ring — coefficients are bare mpz_class (GMP integers). More... | |
| struct | parsing_error |
| class | IdentifierHash |
| IdentifierHash: used to facilitate parsing of polynomials from strings and files. More... | |
Functions | |
| BasicPoly | parseBasicPoly (std::string poly, std::vector< std::string > varnames) |
| void | parseBasicPoly (const std::string_view &str, const IdentifierHash &idenHash, BasicPoly &result) |
| This version is a potentially faster alternative when reading many polynomials. | |
Minimal, portable polynomial value type used where heavier engine types would be overkill.
BasicPoly stores a polynomial as three parallel std::vectors: mCoefficients (one mpz_class per term), mComponents (one int per term naming the free-module component, or empty as shorthand for "all components are zero"), and mMonomials (a flat concatenation of varpower-encoded monomials, each prefixed by its own length so the array can be walked sequentially). The type carries no reference to a specific ring or monomial layout, which makes it the right vehicle for serialisation, parser-fed test inputs, and the streaming constructors of newer Groebner-basis code (notably gb-f4). The in-source TODO comment flags extending coefficients to GF(p^n), QQ, fraction fields, or polynomial coefficients as future work.
The same header also declares the polynomial-text parser support: a parsing_error exception type, an IdentifierHash that maps variable-name string_views to integer indices via an internal unordered_map, and two parseBasicPoly overloads (one taking a fresh varnames list, one taking a pre-built IdentifierHash for faster repeated parsing). The companion BasicPolyList (a std::vector<BasicPoly> plus stream helpers) and BasicPolyListParser (the line-per-poly text format used by tests) live alongside.
Definition in file BasicPoly.hpp.