37 namespace S = Singular;
47 fputs(
"ideal I =", getFile());
53 fputs(first ?
"\n " :
",\n ", getFile());
59 fputs(first ?
"\n " :
",\n ", getFile());
65 fputs(
"\n 0", getFile());
66 fputs(
";\n", getFile());
81 fputs(
"poly p =", getFile());
87 bool firstGenerator) {
88 fputs(
"\n ", getFile());
93 const vector<mpz_class>& term,
94 bool firstGenerator) {
95 fputs(
"\n ", getFile());
101 fputs(
"\n 0", getFile());
102 fputs(
";\n", getFile());
108 "Format understandable by the program Singular.") {
137 vector<mpz_class>& term) {
157 }
while (in.
match(
','));
169 names.
getName(0) != string(
"dummy")) {
172 "A singular ring with no actual variables must have a single " 173 "place-holder variable named \"dummy\", and in this case ";
176 <<
" place-holder variables.";
178 errorMsg <<
"it has the name \"" << names.
getName(0) <<
"\".";
183 }
else if (!in.
match(
'0')) {
192 return in.
peek(
'r') || in.
peek(
'R');
204 if (!in.
match(
'0')) {
208 }
while (in.
match(
','));
223 if (!in.
match(
'0')) {
226 }
while (in.
match(
','));
250 }
while (!in.
match(
';'));
256 fputs(
"ring R = 0, (dummy), lp;\nint noVars = 1;\n", out);
258 fputs(
"ring R = 0, (", out);
260 const char* pre =
"";
261 for (
unsigned int i = 0; i < names.
getVarCount(); ++i) {
263 fputs(names.
getName(i).c_str(), out);
266 fputs(
"), lp;\nint noVars = 0;\n", out);
static const DataType & getPolynomialType()
Returns the one and only instance for polynomials.
This class contains further functionality that makes it more convenient to derive from than IOHandler...
virtual void consume(const vector< mpz_class > &term)=0
void readCoefTerm(BigPolynomial &polynomial, bool firstTerm, Scanner &in)
virtual void consumeRing(const VarNames &names)=0
void writeRing(const VarNames &names, FILE *out)
virtual void doWriteHeader(bool first)
virtual void doWriteTerm(const vector< mpz_class > &term, const VarNames &names, FILE *out)
virtual void beginConsuming()=0
Tell the consumer to begin consuming an ideal.
virtual void doWriteFooter(bool wasZeroIdeal)
static const DataType & getMonomialIdealListType()
Returns the one and only instance for monomial ideal lists.
virtual void doWriteTerm(const vector< mpz_class > &term, bool first)
void clear()
Resets the number of variables to zero.
void registerOutput(const DataType &type)
Specify that output of the argument type is supported.
virtual void consume(const mpz_class &coef, const Term &term)
virtual void doWriteTerm(const mpz_class &coef, const vector< mpz_class > &term, bool firstGenerator)
void readTermProduct(Scanner &in, const VarNames &names, vector< mpz_class > &term)
virtual void doReadBareIdeal(Scanner &in, const VarNames &names, BigTermConsumer &consumer)
virtual CoefBigTermConsumer * doCreatePolynomialWriter(FILE *out)
Defines the variables of a polynomial ring and facilities IO involving them.
virtual void doWriteHeader()
virtual void doReadTerm(Scanner &in, const VarNames &names, vector< mpz_class > &term)
virtual void doneConsuming()=0
Must be called once after each time beginConsuming has been called.
void addVarSyntaxCheckUnique(const Scanner &in, const string &name)
As addvar, except it reports a syntax error if name is already a variable.
This class offers an input interface which is more convenient and for some purposes more efficient th...
void writeCoefTermProduct(const mpz_class &coef, const Term &term, const TermTranslator &translator, bool hidePlus, FILE *out)
virtual void doWriteFooter(bool wasZero)
static const char * staticGetName()
SingularIdealWriter(FILE *out)
SingularPolyWriter(FILE *out)
void registerInput(const DataType &type)
Specify that input of the argument type is supported.
virtual bool doPeekRing(Scanner &in)
virtual void doWriteTerm(const mpz_class &coef, const Term &term, const TermTranslator &translator, bool firstGenerator)
bool peek(char character)
Skips whitespace and returns true if the next character is equal to the parameter(s).
const char * readIdentifier()
The returned string is only valid until the next method on this object gets called.
virtual void doWriteTerm(const Term &term, const TermTranslator &translator, bool first)
void readTerm(Scanner &in, const VarNames &names, vector< mpz_class > &term)
TermTranslator handles translation between terms whose exponents are infinite precision integers and ...
void expect(char expected)
Require the next character to be equal to expected.
void reportSyntaxError(const Scanner &scanner, const string &errorMsg)
static const DataType & getMonomialIdealType()
Returns the one and only instance for monomial ideals.
virtual BigTermConsumer * doCreateIdealWriter(FILE *out)
virtual void doWriteEmptyList()
void writeTermProduct(const Term &term, const TermTranslator &translator, FILE *out)
virtual void doReadRing(Scanner &in, VarNames &names)
size_t getVarCount() const
Returns the current number of variables.
const string & getName(size_t index) const
The returned reference can become invalid next time addVar is called.
A replacement for stringstream.
Term represents a product of variables which does not include a coefficient.
virtual void beginConsuming()=0
bool match(char c)
Return true if the next character is c, and in that case skip past it.
virtual void doneConsuming()=0
virtual void doReadBarePolynomial(Scanner &in, const VarNames &names, CoefBigTermConsumer &consumer)