51 return std::find(_supportedInputs.begin(), _supportedInputs.end(),
52 &
type) != _supportedInputs.end();
56 return std::find(_supportedOutputs.begin(), _supportedOutputs.end(),
57 &
type) != _supportedOutputs.end();
64 _supportedInputs.push_back(&
type);
71 _supportedOutputs.push_back(&
type);
97 return !
in.matchEOF();
105 return _formatDescription;
110 vector<mpz_class>& term) {
111 term.resize(
names.getVarCount());
112 for (
size_t var = 0; var < term.size(); ++var)
120 }
while (
in.match(
'*'));
145 const vector<mpz_class>& term,
152 bool isIdentity =
true;
153 for (
size_t var = 0; var < term.size(); ++var)
175 for (
size_t var = 0; var <
varCount; ++var) {
176 const char*
exp =
translator.getVarExponentString(var, term[var]);
197 for (
size_t var = 0; var <
varCount; ++var) {
207 if ((term[var]) != 1) {
225 }
while (
in.match(
'*'));
229 vector<mpz_class>& term,
233 term.resize(
names.getVarCount());
234 for (
size_t var = 0; var < term.size(); ++var)
240 else if (
in.match(
'-'))
246 if (
in.match(
'+') ||
in.match(
'-'))
249 if (
in.peekIdentifier()) {
253 in.readInteger(coef);
255 while (
in.match(
'*'))
267 vector<mpz_class>& term =
polynomial.getLastTerm();
275 size_t var =
in.readVariable(
names);
277 if (term[var] != 0) {
280 name +
" appears more than once in monomial.");
284 in.readInteger(term[var]);
285 if (term[var] <= 0) {
287 errorMsg <<
"Expected positive integer as exponent but got "
void nameFactoryRegister(NameFactory< AbstractProduct > &factory)
Registers the string returned by ConcreteProduct::getStaticName() to a function that default-construc...
const VarNames & getNames() const
vector< mpz_class > & getLastTermRef()
The intention of this class is to describe the different kinds of mathematical structures that Frobby...
A replacement for stringstream.
void registerInput(const DataType &type)
Specify that input of the argument type is supported.
virtual void doReadTerm(Scanner &in, InputConsumer &term)
virtual void doReadSatBinomIdeal(Scanner &in, SatBinomConsumer &consumer)
virtual BigTermConsumer * doCreateIdealWriter(FILE *out)=0
virtual bool doSupportsInput(const DataType &type) const
virtual void doReadIdeal(Scanner &in, InputConsumer &consumer)
virtual const char * doGetDescription() const
virtual const char * doGetName() const
virtual bool doSupportsOutput(const DataType &type) const
IOHandlerImpl(const char *formatName, const char *formatDescription)
virtual bool doHasMoreInput(Scanner &in) const
virtual CoefBigTermConsumer * doCreatePolynomialWriter(FILE *out)
virtual void doReadPolynomial(Scanner &in, CoefBigTermConsumer &consumer)
virtual void doReadIdeals(Scanner &in, InputConsumer &consumer)
void registerOutput(const DataType &type)
Specify that output of the argument type is supported.
This class offers an input interface which is more convenient and for some purposes more efficient th...
TermTranslator handles translation between terms whose exponents are infinite precision integers and ...
Term represents a product of variables which does not include a coefficient.
size_t getVarCount() const
static bool isIdentity(const Exponent *a, size_t varCount)
Returns whether a is 1, i.e. whether all entries of a are 0.
Defines the variables of a polynomial ring and facilities IO involving them.
void reportSyntaxError(const Scanner &scanner, const string &errorMsg)
#define INTERNAL_ERROR_UNIMPLEMENTED()
void writeCoefTermProduct(const mpz_class &coef, const Term &term, const TermTranslator &translator, bool hidePlus, FILE *out)
void readVarPower(vector< mpz_class > &term, const VarNames &names, Scanner &in)
void readCoefTerm(BigPolynomial &polynomial, bool firstTerm, Scanner &in)
void readTermProduct(Scanner &in, const VarNames &names, vector< mpz_class > &term)
void writeTermProduct(const Term &term, const TermTranslator &translator, FILE *out)