14 #include <unordered_set>
22 template <
class Polynomial,
template<
class>
class Datastructure = IdealDatastructureVector,
int CacheSize = 0>
36 Ideal(
const Polynomial& p1,
const Polynomial& p2):
58 if(
this == &rhs)
return *
this;
110 std::vector<size_t> orderedIndices;
113 orderedIndices.push_back(i);
116 std::sort(orderedIndices.begin(), orderedIndices.end(),
mTermOrder);
117 return orderedIndices;
132 std::vector<Polynomial> tempGen;
166 if(!it->is_linear())
return false;
177 std::set<unsigned> vars;
180 it->gatherVariables(vars);
204 os << p << std::endl;
209 void print(
bool printOrigins=
true, std::ostream& os = std::cout)
const
211 for(
typename std::vector<Polynomial>::const_iterator it =
mGenerators.begin(); it !=
mGenerators.end(); ++it)
217 it->getReasons().print();
carl is the main namespace for the library.
Sorts generators of an ideal by their leading terms.
void eliminateGenerator(size_t index)
size_t addGenerator(const Polynomial &f)
void removeEliminated()
Invalidates indices.
std::vector< Polynomial > mGenerators
const Polynomial & getGenerator(size_t index) const
const std::vector< Polynomial > & getGenerators() const
bool is_linear() const
Checks whether all polynomials occurring in this ideal are linear.
std::unordered_set< size_t > mEliminated
friend std::ostream & operator<<(std::ostream &os, const Ideal &rhs)
sortByLeadingTerm< Polynomial > mTermOrder
void print(bool printOrigins=true, std::ostream &os=std::cout) const
std::vector< size_t > getOrderedIndices()
std::vector< Polynomial > & getGenerators()
bool isDividable(const Term< typename Polynomial::CoeffType > &m)
size_t nrGenerators() const
std::set< unsigned > gatherVariables() const
Gather all variables occurring in this ideal.
DivisionLookupResult< Polynomial > getDivisor(const Term< typename Polynomial::CoeffType > &t) const
Datastructure< Polynomial > mDivisorLookup
Ideal(const Polynomial &p1, const Polynomial &p2)
Ideal & operator=(const Ideal &rhs)