37 ASSERT(a.size() == b.size());
38 for (
size_t i = 0; i < a.size(); ++i) {
64 for (; it != ideal.
end(); ++it) {
76 for (; it != ideal.
end(); ++it) {
87 for (; it != ideal.
end(); ++it) {
115 if (capacity <=
_terms.capacity())
129 vector<vector<mpz_class> > tmp;
131 if (capacity > newCapacity)
132 newCapacity = capacity;
134 tmp.reserve(newCapacity);
135 tmp.resize(
_terms.size());
137 size_t size =
_terms.size();
138 for (
size_t i = 0; i < size; ++i)
147 for (vector<vector<mpz_class> >::const_iterator it =
_terms.begin();
150 if (
lcm[var] < (*it)[var])
151 lcm[var] = (*it)[var];
172 for (
size_t t = 0; t <
_terms.size(); ++t) {
173 if (t == ideal.
_terms.size())
176 const vector<mpz_class>& a =
_terms[t];
177 const vector<mpz_class>& b = ideal.
_terms[t];
179 ASSERT(a.size() == b.size());
181 for (
size_t i = 0; i < a.size(); ++i) {
199 if (
_terms[gen][var] != 0)
210 if (
_terms[gen][var] > term[var])
238 if (var != varToErase)
265 vector<vector<mpz_class> >::iterator end =
_terms.end();
266 for (vector<vector<mpz_class> >::iterator it =
_terms.begin();
275 vector<vector<mpz_class> >::iterator newEnd =
281 size_t size =
_terms.size();
282 vector<size_t> sortedOffsets(size);
283 for (
size_t term = 0; term < size; ++term)
284 sortedOffsets[term] = term;
286 std::sort(sortedOffsets.begin(), sortedOffsets.end(),
289 vector<vector<mpz_class> > sorted;
290 sorted.reserve(
_terms.capacity());
292 for (
size_t term = 0; term < size; ++term)
293 sorted[term].
swap(
_terms[sortedOffsets[term]]);
301 for (
size_t i = 0; i <
_terms.size(); ++i)
313 fputs(out.str().c_str(), file);
317 out <<
"/---- BigIdeal of " <<
_terms.size() <<
" terms:\n";
318 for (vector<vector<mpz_class> >::const_iterator it =
_terms.begin();
319 it !=
_terms.end(); ++it) {
320 for (vector<mpz_class>::const_iterator entry = it->begin();
321 entry != it->end(); ++entry)
322 out << *entry <<
' ';
325 out <<
"----/ End of list.\n";
350 const vector<mpz_class>& b) {
351 ASSERT(a.size() == b.size());
352 for (
size_t i = 0; i < a.size(); ++i) {
366 ostream&
operator<<(ostream& out,
const vector<BigIdeal>& ideals) {
367 out <<
"List of " << ideals.size() <<
" ideals:\n";
368 for (
size_t i = 0; i < ideals.size(); ++i)
ostream & operator<<(ostream &out, const BigIdeal &ideal)
void reserve(size_t capacity)
void eraseVar(size_t var)
void clearAndSetNames(const VarNames &names)
void swap(BigIdeal &ideal)
static bool bigTermCompare(const vector< mpz_class > &a, const vector< mpz_class > &b)
void sortGeneratorsUnique()
const vector< mpz_class > & getTerm(size_t term) const
mpz_class & getLastTermExponentRef(size_t var)
void renameVars(const VarNames &names)
void getLcm(vector< mpz_class > &lcm) const
bool contains(const vector< mpz_class > &term) const
vector< vector< mpz_class > > _terms
size_t getVarCount() const
bool operator==(const BigIdeal &b) const
void insert(const Ideal &ideal)
const VarNames & getNames() const
size_t getGeneratorCount() const
void projectVar(size_t var)
bool operator<(const BigIdeal &ideal) const
void print(FILE *file) const
bool containsIdentity() const
const mpz_class & getExponent(size_t term, size_t var) const
bool addVarToClearedIdeal(const char *var)
vector< mpz_class > & getLastTermRef()
void setExponent(size_t term, size_t var, const mpz_class &exp)
Represents a monomial ideal with int exponents.
size_t getGeneratorCount() const
Cont::const_iterator const_iterator
const_iterator end() const
const_iterator begin() const
OffsetTermCompare(const BigIdeal &ideal)
bool operator()(size_t aa, size_t bb) const
void operator=(const OffsetTermCompare &)
const_iterator doesn't have all it needs to be a proper STL iterator.
size_t getGeneratorCount() const
TermTranslator handles translation between terms whose exponents are infinite precision integers and ...
const mpz_class & getExponent(size_t variable, Exponent exponent) const
This method translates from IDs to arbitrary precision integers.
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.
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.
void swap(VarNames &names)
void projectVar(size_t index)
bool getExponent(const Word *a, size_t var)
returns true if var divides a and false otherwise.
void lcm(Word *res, const Word *resEnd, const Word *a, const Word *b)
void getOrderedNames(VarNames &names)
void permute(vector< mpz_class > &term)