carl  24.04
Computer ARithmetic Library
CoprimePart.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../CoCoAAdaptor.h"
5 
6 namespace carl {
7 
8 template<typename C, typename O, typename P>
9 class MultivariatePolynomial;
10 
11 /**
12 * Calculates the coprime part of p and q.
13 */
14 template<typename C, typename O, typename P>
16  if (p.is_constant() || q.is_constant()) {
17  return p;
18  }
19 
20  auto s = overloaded {
21  #if defined USE_COCOA
22  [](const MultivariatePolynomial<mpq_class,O,P>& p, const MultivariatePolynomial<mpq_class,O,P>& q){ CoCoAAdaptor<MultivariatePolynomial<mpq_class,O,P>> c({p, q}); return c.makeCoprimeWith(p, q); },
23  [](const MultivariatePolynomial<mpz_class,O,P>& p, const MultivariatePolynomial<mpz_class,O,P>& q){ CoCoAAdaptor<MultivariatePolynomial<mpz_class,O,P>> c({p, q}); return c.makeCoprimeWith(p, q); }
24  #else
27  #endif
28  #if defined USE_GINAC
29  ,
32  #endif
33  };
34  return s(p, q);
35 }
36 
37 }
A small wrapper that configures logging for carl.
carl is the main namespace for the library.
MultivariatePolynomial< C, O, P > coprimePart(const MultivariatePolynomial< C, O, P > &p, const MultivariatePolynomial< C, O, P > &q)
Calculates the coprime part of p and q.
Definition: CoprimePart.h:15
The general-purpose multivariate polynomial class.
bool is_constant() const
Check if the polynomial is constant.