7 template<
typename Number,
typename Coeff>
11 bool use_lazard =
false
13 std::vector<MultivariatePolynomial<Number>> polys;
14 std::vector<Variable> varOrder;
17 CARL_LOG_TRACE(
"carl.ran.interval",
"Substituting using Lazard evaluation");
19 for (
const auto& vic: m) {
20 varOrder.emplace_back(vic.first);
21 auto res = le.
substitute(vic.first, vic.second,
true);
23 polys.emplace_back(vic.first - res.second);
25 polys.emplace_back(res.second);
27 CARL_LOG_TRACE(
"carl.ran.interval", vic.first <<
" -> " << vic.second <<
" is now " << polys.back());
29 polys.emplace_back(le.getLiftingPoly());
31 CARL_LOG_TRACE(
"carl.ran.interval",
"main poly " << p <<
" in " << p.
main_var() <<
" is now " << polys.back());
33 CARL_LOG_TRACE(
"carl.ran.interval",
"Substituting using field extensions only");
35 for (
const auto& vic: m) {
36 varOrder.emplace_back(vic.first);
37 auto res = fe.
extend(vic.first, vic.second);
39 polys.emplace_back(vic.first - res.second);
41 polys.emplace_back(res.second);
43 CARL_LOG_TRACE(
"carl.ran.interval", vic.first <<
" -> " << vic.second <<
" is now " << polys.back());
45 polys.emplace_back(p);
47 CARL_LOG_TRACE(
"carl.ran.interval",
"main poly " << p <<
" in " << p.
main_var() <<
" is now " << polys.back());
50 CARL_LOG_TRACE(
"carl.ran.interval",
"Perform algebraic substitution on " << polys <<
" wrt " << varOrder);
This file contains carl::algebraic_substitution which performs what we call an algebraic substitution...
#define CARL_LOG_TRACE(channel, msg)
std::vector< std::pair< Variable, T > > OrderedAssignment
std::optional< UnivariatePolynomial< Number > > substitute_rans_into_polynomial(const UnivariatePolynomial< Coeff > &p, const OrderedAssignment< IntRepRealAlgebraicNumber< Number >> &m, bool use_lazard=false)
std::optional< UnivariatePolynomial< Number > > algebraic_substitution(const UnivariatePolynomial< MultivariatePolynomial< Number >> &p, const std::vector< UnivariatePolynomial< MultivariatePolynomial< Number >>> &polynomials, AlgebraicSubstitutionStrategy strategy=AlgebraicSubstitutionStrategy::RESULTANT)
Computes the algebraic substitution of the given defining polynomials into a multivariate polynomial ...
This class represents a univariate polynomial with coefficients of an arbitrary type.
Variable main_var() const
Retrieves the main variable of this polynomial.
This class can be used to construct iterated field extensions from a sequence of real algebraic numbe...
std::pair< bool, Poly > extend(Variable v, const IntRepRealAlgebraicNumber< Rational > &r)
Extend the current number field with the field extension defined by r.
auto substitute(Variable v, const IntRepRealAlgebraicNumber< Rational > &r, bool divideZeroFactors=true)