Go to the documentation of this file.
44 void writeTerm(
const vector<mpz_class>& term, FILE* out);
50 size_t generatorCount,
54 size_t generatorCount,
58 namespace F = Fourti2;
72 (
unsigned long)generatorCount,
73 (
unsigned long)
getNames().getVarCount());
82 virtual void doWriteTerm(
const vector<mpz_class>& term,
bool first) {
107 fprintf(
getFile(),
"%lu %lu\n",
108 (
unsigned long)termCount,
109 (
unsigned long)
getNames().getVarCount() + 1);
115 bool firstGenerator) {
118 mpz_out_str(
getFile(), 10, coef.get_mpz_t());
128 const vector<mpz_class>& term,
129 bool firstGenerator) {
132 mpz_out_str(
getFile(), 10, coef.get_mpz_t());
142 fputs(
"(coefficient)",
getFile());
152 "Format used by the software package 4ti2.") {
186 fputs(
"_fourtitwo_identity", out);
196 size_t generatorCount;
213 size_t generatorCount;
236 size_t generatorCount;
244 (
"A polynomial has at least one column in the matrix,"
245 "but this matrix has no columns.");
253 for (
size_t t = 0; t < generatorCount; ++t) {
258 vector<mpz_class>& term = polynomial.
getLastTerm();
259 for (
size_t var = 0; var < varCount; ++var) {
260 ASSERT(var < term.size());
265 if (!in.
match(
'(')) {
268 in.
expect(
"(coefficient)");
275 for (
size_t var = 0; var < varCount; ++var)
285 size_t generatorCount;
295 fputs(
"42 ring\n", out);
304 for (
size_t var = 0; var < names.
getVarCount(); ++var) {
307 fputs(names.
getName(var).c_str(), out);
316 in.
expect(
"_fourtitwo_identity");
318 for (
size_t var = 0; var < varCount; ++var) {
336 for (
size_t var = 0; var < varCount; ++var)
340 void F::writeTerm(
const vector<mpz_class>& term, FILE* out) {
341 size_t varCount = term.size();
342 for (
size_t var = 0; var < varCount; ++var) {
344 mpz_out_str(out, 10, term[var].get_mpz_t());
357 for (
size_t var = 0; var < varCount; ++var) {
377 size_t generatorCount,
383 for (
size_t t = 0; t < generatorCount; ++t) {
388 for (
size_t t = 0; t < generatorCount; ++t)
402 size_t generatorCount,
409 ideal.reserve(generatorCount);
410 for (
size_t t = 0; t < generatorCount; ++t) {
413 vector<mpz_class>& binom = ideal.getLastBinomRef();
414 for (
size_t var = 0; var < varCount; ++var)
421 ideal.renameVars(names);
428 string msg =
"Using the format ";
430 msg +=
" makes it necessary to store all of the output in "
431 "memory before writing it out. This increases "
432 "memory consumption and decreases performance.";
void readTerm(Scanner &in, InputConsumer &consumer)
static const DataType & getMonomialIdealListType()
Returns the one and only instance for monomial ideal lists.
virtual void doWriteTerm(const mpz_class &coef, const vector< mpz_class > &term, bool firstGenerator)
void readInteger(mpz_class &integer)
Read an arbitrary-precision integer.
virtual BigTermConsumer * doCreateIdealWriter(FILE *out)
static const DataType & getPolynomialType()
Returns the one and only instance for polynomials.
void expectEOF()
Require that there is no more input.
mpz_class & getLastCoef()
This class offers an input interface which is more convenient and for some purposes more efficient th...
void registerInput(const DataType &type)
Specify that input of the argument type is supported.
static const DataType & getSatBinomIdealType()
Returns the one and only instance for saturated binomial ideals.
virtual void doWriteHeader(bool first)
const VarNames & getNames()
virtual CoefBigTermConsumer * doCreatePolynomialWriter(FILE *out)
size_t getVarCount() const
void writeRing(const VarNames &names, FILE *out)
bool match(char c)
Return true if the next character is c, and in that case skip past it.
const char * readIdentifier()
The returned string is only valid until the next method on this object gets called.
const string & getName(size_t index) const
The returned reference can become invalid next time addVar is called.
virtual void doWriteTerm(const vector< mpz_class > &term, bool first)
void renameVars(const VarNames &names)
TermTranslator handles translation between terms whose exponents are infinite precision integers and ...
virtual void doReadPolynomial(Scanner &in, CoefBigTermConsumer &consumer)
void addVarSyntaxCheckUnique(const Scanner &in, const string &name)
As addvar, except it reports a syntax error if name is already a variable.
void readIntegerAndNegativeAsZero(mpz_class &integer)
Read an integer and set it to zero if it is negative.
size_t getVarCount() const
bool hasMoreInput(Scanner &in) const
const VarNames & getNames() const
This class contains a minimum level of functionality that makes it more convenient to derive from tha...
size_t getVarCount() const
Returns the current number of variables.
static const char * staticGetName()
void writeTerm(const vector< mpz_class > &term, FILE *out)
virtual void doWriteFooter(bool wasZero)
virtual void doWriteHeader(size_t termCount)
void display4ti2Warning()
Term represents a product of variables which does not include a coefficient.
Represents a saturated binomial ideal.
void readRing(Scanner &in, VarNames &names)
vector< mpz_class > & getLastTerm()
void expect(char expected)
Require the next character to be equal to expected.
void expectIntegerNoSign()
Read an arbitrary-precision integer.
void displayNote(const string &msg)
Display msg to standard error in a way that indicates that this is something that the user should tak...
const char * getExponentString(size_t variable, Exponent exponent) const
as getExponent, except the string "e" is returned, where e is the exponent.
void clear()
Resets the number of variables to zero.
virtual void doWriteHeader()
Fourti2IdealWriter(FILE *out)
void registerOutput(const DataType &type)
Specify that output of the argument type is supported.
void readSizeT(size_t &size)
Reads a size_t, where the representable range of that type determines when the number is too big.
static const DataType & getMonomialIdealType()
Returns the one and only instance for monomial ideals.
void reportError(const string &errorMsg)
virtual void consume(const vector< mpz_class > &term)=0
#define INTERNAL_ERROR_UNIMPLEMENTED()
virtual void doWriteTerm(const mpz_class &coef, const Term &term, const TermTranslator &translator, bool firstGenerator)
Fourti2PolyWriter(FILE *out)
void readIdeal(Scanner &in, InputConsumer &consumer, size_t generatorCount, size_t varCount)
virtual void doWriteTerm(const vector< mpz_class > &term, const VarNames &names, FILE *out)
virtual void doWriteEmptyList()
virtual void consume(const mpz_class &coef, const Term &term)
virtual void doWriteFooter(bool wasZeroIdeal)
virtual void doReadTerm(Scanner &in, InputConsumer &consumer)
void readRing(Scanner &in, VarNames &names, size_t varCount)
virtual void doWriteTerm(const Term &term, const TermTranslator &translator, bool first)
bool peekIdentifier()
Skips whitespace and returns true if the next token is an identifier.
Defines the variables of a polynomial ring and facilities IO involving them.
bool addVar(const string &name)
Adds the variable and returns true if name is not already a variable.
virtual void doReadIdeal(Scanner &in, InputConsumer &consumer)
void writeTerm(const Term &term, const TermTranslator &translator, FILE *out)
void readSatBinomIdeal(Scanner &in, SatBinomConsumer &consumer, size_t generatorCount, size_t varCount)
virtual void doReadSatBinomIdeal(Scanner &in, SatBinomConsumer &consumer)
virtual void doWriteHeader(bool first, size_t generatorCount)
virtual void doReadIdeals(Scanner &in, InputConsumer &consumer)
void writeRingWithoutHeader(const VarNames &names, FILE *out)