10 #include "../UnivariatePolynomial.h"
24 template<
typename Integer>
66 const std::vector<Polynomial>& a,
72 assert(a.size() > (
unsigned)1);
74 size_t v = I.size() + 1;
76 Integer alpha_v = I.rend()->second;
83 for(
unsigned i = 1; i <= r; i++) {
87 std::vector<MultiPoly> b;
88 for(
unsigned j = 1; j <= r; j++) {
89 b[j] =
A / Multipoly(a[j]);
92 std::vector<Polynomial> a_new;
93 for(
unsigned i = 1; i <= r; i++) {
94 a_new.pushBack(
substitute(a[i], x_v, alpha_v));
99 std::map<Variable, GFNumber<Integer>> I_new(I);
102 std::vector<Polynomial> sigma = MultivariateDiophant(a_new, c_new, I_new, d);
106 for(
unsigned i = 1; i <= r; i++) {
107 c -= sigma[i] * b[i];
110 for(
unsigned m = 1; m <= d; m++) {
122 std::vector<Polynomial> sigma(r,
Polynomial(0));
123 for(
auto& z : c.
terms()) {
141 assert(a.size() > 1);
145 std::vector<Polynomial> s =
EEAlift(a.back(), a.front());
148 return { d.
remainder.normalizeCoefficients(), (xm * s.back() + q * a.back()).normalizeCoefficients() };
152 assert(a.size() > 2);
154 assert(a.size() == s.size());
155 std::vector<Polynomial> res;
156 for(
unsigned j = 0; j < s.size(); ++j)
158 res.push_back( (xm * s.at(j)).remainder(a.at(j)).normalizeCoefficients());
166 assert(a.size() > 2);
167 const Variable& x = a.front().main_var();
173 for(
size_t j = r - 2; j < r-1; --j)
175 q[j] = a[j+1] * q[j+1];
177 std::vector<Polynomial> s;
179 for(
unsigned j = 0; j < r-1; ++j)
182 assert(sigma.size() == 2);
183 beta = sigma.front();
184 s.push_back(sigma.back());
188 assert(s.size() == a.size());
203 CARL_LOG_DEBUG(
"carl.core.hensel",
"EEALIFT: a=" << a <<
", b=" << b );
207 CARL_LOG_DEBUG(
"carl.core.hensel",
"EEALIFT: a mod p=" << amodp <<
", b mod p=" << bmodp );
212 CARL_LOG_DEBUG(
"carl.core.hensel",
"EEALIFT: g=" << g <<
", s=" << s <<
", t=" << t );
220 for(
unsigned j=1; j<
mGf_pk->
k(); ++j)
234 Polynomial tau = (tauprime + q * amodp).normalizeCoefficients();
244 template<
typename Coeff,
typename Ordering,
typename Policies>
A small wrapper that configures logging for carl.
#define CARL_LOG_ASSERT(channel, condition, msg)
#define CARL_LOG_DEBUG(channel, msg)
#define CARL_LOG_NOTIMPLEMENTED()
carl is the main namespace for the library.
UnivariatePolynomial< Coeff > extended_gcd(const UnivariatePolynomial< Coeff > &a, const UnivariatePolynomial< Coeff > &b, UnivariatePolynomial< Coeff > &s, UnivariatePolynomial< Coeff > &t)
Calculates the extended greatest common divisor g of two polynomials.
typename UnderlyingNumberType< P >::type Coeff
Coeff substitute(const Monomial &m, const std::map< Variable, Coeff > &substitutions)
Applies the given substitutions to a monomial.
A Variable represents an algebraic variable that can be used throughout carl.
BaseIntType p() const noexcept
Returns the p from Z_{p^k}.
BaseIntType k() const noexcept
Returns the k from Z_{p^k}.
Galois Field numbers, i.e.
This class represents a univariate polynomial with coefficients of an arbitrary type.
Variable main_var() const
Retrieves the main variable of this polynomial.
bool is_one() const
Checks if the polynomial is equal to one.
UnivariatePolynomial< typename IntegralType< Coefficient >::type > to_integer_domain() const
Works only from rationals, if the numbers are already integers.
UnivariatePolynomial< GFNumber< typename IntegralType< Coefficient >::type > > toFiniteDomain(const GaloisField< typename IntegralType< Coefficient >::type > *galoisField) const
The general-purpose multivariate polynomial class.
const TermsType & terms() const
A strongly typed pair encoding the result of a division, being a quotient and a remainder.
Includes the algorithms 6.2 and 6.3 from the book Algorithms for Computer Algebra by Geddes,...
const GaloisField< Integer > * mGf_p
std::vector< Polynomial > MultiTermEEAlift(const std::vector< Polynomial > &a) const
DiophantineEquations(unsigned p, unsigned k)
std::vector< Polynomial > EEAlift(Polynomial a, Polynomial b) const
EEAlift computes s,t such that s*a + tb == 1 (mod p^k) with deg(s) < deg(b) and deg(t) < deg(a).
const GaloisField< Integer > * mGf_pk
MultivariatePolynomial< GFNumber< Integer > > MultiPoly
std::vector< Polynomial > solveMultivariateDiophantine(const std::vector< Polynomial > &a, const MultiPoly &c, const std::map< Variable, GFNumber< Integer >> &I, unsigned d) const
Solve in the domain Z_(p^k)[x_!,...,x_v] the multivariate polynomial diophantine equation sigma_1 * b...
std::vector< Polynomial > univariateDiophantine(const std::vector< Polynomial > &a, Variable::Arg x, unsigned m) const
Solve in Z_(p^k)[x] the univariate polynomial Diophantine equation: s_1 x b_1 + .....
UnivariatePolynomial< GFNumber< Integer > > Polynomial
UnivariatePolynomial< MultivariatePolynomial< Coeff, Ordering, Policies > > UnivReprPol
static std::list< UnivReprPol > calculate(const UnivReprPol &, const std::map< Variable, Coeff > &, Integer)