17 template<
typename Pol>
25 if (e.first == _exclude)
continue;
26 if (e.second.max_degree() == 1) {
27 auto d = e.second.coeffs().find(1);
28 assert(d != e.second.coeffs().end());
30 return std::make_pair(e.first, (
Pol(e.first) * d->second - c.
lhs()) / d->second.constant_part());
37 template<
typename Pol>
40 if (c.
lhs().nr_terms() > 2)
return std::nullopt;
41 if (c.
lhs().nr_terms() == 0)
return std::nullopt;
42 if (!c.
lhs().lterm().is_single_variable())
return std::nullopt;
43 if (c.
lhs().nr_terms() == 1) {
44 return std::make_pair(c.
lhs().lterm().single_variable(),0);
46 assert(c.
lhs().nr_terms() == 2);
47 if (!c.
lhs().trailingTerm().is_constant())
return std::nullopt;
48 return std::make_pair(c.
lhs().lterm().single_variable(), -c.
lhs().trailingTerm().coeff() / c.
lhs().lterm().coeff());
MultivariatePolynomial< Rational > Pol
carl is the main namespace for the library.
Interval< Number > abs(const Interval< Number > &_in)
Method which returns the absolute value of the passed number.
VarInfo< MultivariatePolynomial< Coeff, Ordering, Policies > > var_info(const MultivariatePolynomial< Coeff, Ordering, Policies > &poly, const Variable var, bool collect_coeff=false)
std::optional< std::pair< Variable, Pol > > get_substitution(const BasicConstraint< Pol > &c, bool _negated=false, Variable _exclude=carl::Variable::NO_VARIABLE, std::optional< VarsInfo< Pol >> var_info=std::nullopt)
If this constraint represents a substitution (equation, where at least one variable occurs only linea...
std::optional< std::pair< Variable, typename Pol::NumberType > > get_assignment(const BasicConstraint< Pol > &c)
VarsInfo< MultivariatePolynomial< Coeff, Ordering, Policies > > vars_info(const MultivariatePolynomial< Coeff, Ordering, Policies > &poly, bool collect_coeff=false)
bool is_one(const Interval< Number > &i)
Check if this interval is a point-interval containing 1.
Represent a polynomial (in)equality against zero.
Relation relation() const
A Variable represents an algebraic variable that can be used throughout carl.
static const Variable NO_VARIABLE
Instance of an invalid variable.