36 template<
typename Number>
44 CoCoAAdaptor<MultivariatePolynomial<Number>> ca(
variables,
true);
46 auto res = ca.GBasis(polynomials);
48 for (
const auto& poly: res) {
54 }
catch (
const CoCoA::ErrorInfo& e) {
55 CARL_LOG_ERROR(
"carl.ran.interval",
"Computation of GBasis failed: " << e <<
" -> " << CoCoA::context(e));
70 template<
typename Number>
75 std::vector<MultivariatePolynomial<Number>> polys;
76 std::vector<Variable> varOrder;
77 for (
const auto& poly: polynomials) {
78 polys.emplace_back(poly);
79 varOrder.emplace_back(poly.main_var());
81 polys.emplace_back(p);
82 varOrder.emplace_back(p.main_var());
84 CARL_LOG_DEBUG(
"carl.ran.interval",
"Converted " << p <<
" and " << polynomials <<
" to " << polys <<
" under " << varOrder);
95 template<
typename Number>
102 for (
auto it = polynomials.rbegin(); it != polynomials.rend(); ++it) {
103 const auto& poly = *it;
104 if (!cur.
has(poly.main_var())) {
108 CARL_LOG_DEBUG(
"carl.ran.interval",
"Computing resultant of " << cur <<
" and " << poly);
113 if (!swpoly.is_univariate()) {
128 template<
typename Number>
134 std::vector<UnivariatePolynomial<MultivariatePolynomial<Number>>> polys;
136 for (std::size_t i = 0; i < polynomials.size() - 1; ++i) {
140 CARL_LOG_DEBUG(
"carl.ran.interval",
"Converted " << polynomials <<
" under " <<
variables <<
" to " << p <<
" and " << polys);
153 template<
typename Number>
159 CARL_LOG_DEBUG(
"carl.ran.interval",
"Substituting " << polynomials <<
" into " << p);
173 template<
typename Number>
179 CARL_LOG_WARN(
"carl.ran.interval",
"Substituting " << polynomials <<
" into " << polynomials.back());
#define CARL_LOG_WARN(channel, msg)
#define CARL_LOG_ERROR(channel, msg)
#define CARL_LOG_DEBUG(channel, msg)
UnivariatePolynomial< C > to_univariate_polynomial(const MultivariatePolynomial< C, O, P > &p)
Convert a univariate polynomial that is currently (mis)represented by a 'MultivariatePolynomial' into...
void variables(const BasicConstraint< Pol > &c, carlVariables &vars)
UnivariatePolynomial< Coeff > pseudo_remainder(const UnivariatePolynomial< Coeff > ÷nd, const UnivariatePolynomial< Coeff > &divisor)
Calculates the pseudo-remainder.
auto resultant(const ContextPolynomial< Coeff, Ordering, Policies > &p, const ContextPolynomial< Coeff, Ordering, Policies > &q)
UnivariatePolynomial< MultivariatePolynomial< typename UnderlyingNumberType< Coeff >::type > > switch_main_variable(const UnivariatePolynomial< Coeff > &p, Variable newVar)
Switches the main variable using a purely syntactical restructuring.
std::optional< UnivariatePolynomial< Number > > algebraic_substitution_groebner(const std::vector< MultivariatePolynomial< Number >> &polynomials, const std::vector< Variable > &variables)
Implements algebraic substitution by Gröbner basis computation.
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 ...
std::optional< UnivariatePolynomial< Number > > algebraic_substitution_resultant(const UnivariatePolynomial< MultivariatePolynomial< Number >> &p, const std::vector< UnivariatePolynomial< MultivariatePolynomial< Number >>> &polynomials)
Implements algebraic substitution by resultant computation.
AlgebraicSubstitutionStrategy
Indicates which strategy to use: resultants or Gröbner bases.
A Variable represents an algebraic variable that can be used throughout carl.
This class represents a univariate polynomial with coefficients of an arbitrary type.
Variable main_var() const
Retrieves the main variable of this polynomial.
bool has(Variable v) const
Checks if the given variable occurs in the polynomial.
UnivariatePolynomial< NumberType > toNumberCoefficients() const
Asserts that is_univariate() is true.