15 template<
typename C,
typename O,
typename P>
18 if (&lhs == &rhs)
return true;
20 if (lhs.
nr_terms() == 0)
return true;
22 static std::mutex mutex;
23 std::lock_guard<std::mutex> lock(mutex);
25 static std::vector<const C*> coeffs;
27 memset(&coeffs[0], 0,
sizeof(
typename std::vector<const C*>::value_type)*coeffs.size());
28 for (
const auto& t: lhs) {
30 if (t.monomial())
id = t.monomial()->id();
31 coeffs[id] = &t.coeff();
33 for (
const auto& t: rhs) {
35 if (t.monomial())
id = t.monomial()->id();
36 if ((coeffs[
id] ==
nullptr) || *coeffs[
id] != t.coeff())
return false;
40 template<
typename C,
typename O,
typename P>
43 if (lhs.
nr_terms() > 1)
return false;
44 return lhs.
lterm() == rhs;
46 template<
typename C,
typename O,
typename P>
48 if (lhs.
nr_terms() != 1)
return false;
49 if (lhs.
lmon() != rhs)
return false;
52 template<
typename C,
typename O,
typename P>
54 if (lhs.
nr_terms() != 1)
return false;
55 if (lhs.
lmon() != rhs)
return false;
58 template<
typename C,
typename O,
typename P>
62 template<
typename C,
typename O,
typename P, DisableIf<std::is_
integral<C>> = dummy>
66 template<
typename C,
typename O,
typename P>
70 template<
typename C,
typename O,
typename P>
74 template<
typename C,
typename O,
typename P>
78 template<
typename C,
typename O,
typename P>
83 template<
typename C,
typename O,
typename P>
88 template<
typename C,
typename O,
typename P>
92 template<
typename C,
typename O,
typename P>
97 template<
typename C,
typename O,
typename P>
111 template<
typename C,
typename O,
typename P>
113 return !(lhs == rhs);
115 template<
typename C,
typename O,
typename P>
117 return !(lhs == rhs);
119 template<
typename C,
typename O,
typename P>
121 return !(lhs == rhs);
123 template<
typename C,
typename O,
typename P>
125 return !(lhs == rhs);
127 template<
typename C,
typename O,
typename P>
129 return !(lhs == rhs);
131 template<
typename C,
typename O,
typename P>
133 return !(lhs == rhs);
135 template<
typename C,
typename O,
typename P>
137 return !(lhs == rhs);
139 template<
typename C,
typename O,
typename P>
141 return !(lhs == rhs);
143 template<
typename C,
typename O,
typename P>
145 return !(lhs == rhs);
148 template<
typename C,
typename O,
typename P>
150 return !(lhs == rhs);
152 template<
typename C,
typename O,
typename P>
154 return !(lhs == rhs);
156 template<
typename C,
typename O,
typename P>
158 return !(lhs == rhs);
160 template<
typename C,
typename O,
typename P>
162 return !(lhs == rhs);
174 template<
typename C,
typename O,
typename P>
178 if (
is_zero(rhs))
return false;
188 for (lit++, rit++; lit != lhs.
rend(); lit++, rit++) {
189 if (rit == rhs.
rend())
return false;
190 if (*lit < *rit)
return true;
191 if (*lit > *rit)
return false;
193 return rit != rhs.
rend();
195 template<
typename C,
typename O,
typename P>
198 return lhs.
lterm() < rhs;
200 template<
typename C,
typename O,
typename P>
203 return lhs.
lterm() < rhs;
205 template<
typename C,
typename O,
typename P>
208 return lhs.
lterm() < rhs;
210 template<
typename C,
typename O,
typename P>
213 return lhs.
lterm() < rhs;
215 template<
typename C,
typename O,
typename P>
217 if (
is_zero(rhs))
return lhs < carl::constant_zero<C>().get();
218 if (lhs < rhs.
lterm())
return true;
222 template<
typename C,
typename O,
typename P>
224 if (
is_zero(rhs))
return false;
225 if (lhs < rhs.
lterm())
return true;
229 template<
typename C,
typename O,
typename P>
231 if (
is_zero(rhs))
return false;
232 if (lhs < rhs.
lterm())
return true;
236 template<
typename C,
typename O,
typename P>
238 if (
is_zero(rhs))
return lhs < carl::constant_zero<C>().get();
239 return lhs < rhs.
lterm();
251 template<
typename C,
typename O,
typename P>
255 template<
typename C,
typename O,
typename P>
259 template<
typename C,
typename O,
typename P>
263 template<
typename C,
typename O,
typename P>
267 template<
typename C,
typename O,
typename P>
271 template<
typename C,
typename O,
typename P>
275 template<
typename C,
typename O,
typename P>
279 template<
typename C,
typename O,
typename P>
283 template<
typename C,
typename O,
typename P>
288 template<
typename C,
typename O,
typename P>
292 template<
typename C,
typename O,
typename P>
296 template<
typename C,
typename O,
typename P>
300 template<
typename C,
typename O,
typename P>
314 template<
typename C,
typename O,
typename P>
318 template<
typename C,
typename O,
typename P>
322 template<
typename C,
typename O,
typename P>
326 template<
typename C,
typename O,
typename P>
330 template<
typename C,
typename O,
typename P>
334 template<
typename C,
typename O,
typename P>
338 template<
typename C,
typename O,
typename P>
342 template<
typename C,
typename O,
typename P>
346 template<
typename C,
typename O,
typename P>
351 template<
typename C,
typename O,
typename P>
355 template<
typename C,
typename O,
typename P>
359 template<
typename C,
typename O,
typename P>
363 template<
typename C,
typename O,
typename P>
377 template<
typename C,
typename O,
typename P>
381 template<
typename C,
typename O,
typename P>
385 template<
typename C,
typename O,
typename P>
389 template<
typename C,
typename O,
typename P>
393 template<
typename C,
typename O,
typename P>
397 template<
typename C,
typename O,
typename P>
401 template<
typename C,
typename O,
typename P>
405 template<
typename C,
typename O,
typename P>
409 template<
typename C,
typename O,
typename P>
414 template<
typename C,
typename O,
typename P>
418 template<
typename C,
typename O,
typename P>
422 template<
typename C,
typename O,
typename P>
426 template<
typename C,
typename O,
typename P>
441 template<
typename C,
typename O,
typename P>
445 template<
typename C,
typename O,
typename P>
449 template<
typename C,
typename O,
typename P>
453 template<
typename C,
typename O,
typename P>
457 template<
typename C,
typename O,
typename P>
461 template<
typename C,
typename O,
typename P>
481 template<
typename C,
typename O,
typename P>
489 template<
typename C, EnableIf<carl::is_number_type<C>> = dummy>
493 template<
typename C,
typename O,
typename P>
501 template<
typename C, EnableIf<carl::is_number_type<C>> = dummy>
505 template<
typename C,
typename O,
typename P>
513 template<
typename C, EnableIf<carl::is_number_type<C>> = dummy>
517 template<
typename C, EnableIf<carl::is_number_type<C>> = dummy>
531 template<
typename C,
typename O,
typename P>
535 template<
typename C,
typename O,
typename P>
539 template<
typename C,
typename O,
typename P>
543 template<
typename C,
typename O,
typename P>
547 template<
typename C,
typename O,
typename P>
551 template<
typename C,
typename O,
typename P>
571 template<
typename C,
typename O,
typename P>
579 template<
typename C, EnableIf<carl::is_number_type<C>> = dummy>
583 template<
typename C,
typename O,
typename P>
591 template<
typename C, EnableIf<carl::is_number_type<C>> = dummy>
595 template<
typename C,
typename O,
typename P>
603 template<
typename C, EnableIf<carl::is_number_type<C>> = dummy>
607 template<
typename C, EnableIf<carl::is_number_type<C>> = dummy>
621 template<
typename C,
typename O,
typename P>
625 template<
typename C,
typename O,
typename P>
629 template<
typename C,
typename O,
typename P>
633 template<
typename C,
typename O,
typename P>
637 template<
typename C,
typename O,
typename P>
641 template<
typename C,
typename O,
typename P>
645 template<
typename C,
typename O,
typename P>
649 template<
typename C,
typename O,
typename P>
653 template<
typename C,
typename O,
typename P>
#define CARL_LOG_INEFFICIENT()
carl is the main namespace for the library.
bool operator>(const BasicConstraint< P > &lhs, const BasicConstraint< P > &rhs)
Interval< Number > operator+(const Interval< Number > &lhs, const Interval< Number > &rhs)
Operator for the addition of two intervals.
bool operator<(const BasicConstraint< P > &lhs, const BasicConstraint< P > &rhs)
bool is_zero(const Interval< Number > &i)
Check if this interval is a point-interval containing 0.
Interval< Number > operator*(const Interval< Number > &lhs, const Interval< Number > &rhs)
Operator for the multiplication of two intervals.
Interval< Number > operator-(const Interval< Number > &rhs)
Unary minus.
bool operator!=(const BasicConstraint< P > &lhs, const BasicConstraint< P > &rhs)
bool operator<=(const BasicConstraint< P > &lhs, const BasicConstraint< P > &rhs)
bool operator==(const BasicConstraint< P > &lhs, const BasicConstraint< P > &rhs)
bool operator>=(const BasicConstraint< P > &lhs, const BasicConstraint< P > &rhs)
bool is_one(const Interval< Number > &i)
Check if this interval is a point-interval containing 1.
A Variable represents an algebraic variable that can be used throughout carl.
This class represents a univariate polynomial with coefficients of an arbitrary type.
The general-purpose multivariate polynomial class.
void makeOrdered() const
Ensure that the terms are ordered.
bool is_constant() const
Check if the polynomial is constant.
const Term< Coeff > & lterm() const
The leading term.
const Coeff & constant_part() const
Retrieve the constant term of this polynomial or zero, if there is no constant term.
const Coeff & lcoeff() const
Returns the coefficient of the leading term.
const Monomial::Arg & lmon() const
The leading monomial.
std::size_t nr_terms() const
Calculate the number of terms.
std::size_t total_degree() const
Calculates the max.
std::shared_ptr< const Monomial > Arg
Represents a single term, that is a numeric coefficient and a monomial.
static MonomialPool & getInstance()
Returns the single instance of this class by reference.