16 ERROR(
"Weyl algebra homogenizing variable out of range");
20 if (derivs->len != comms->len)
22 ERROR(
"Weyl algebra: expected arrays of the same length");
25 for (
unsigned int i = 0; i < derivs->len; i++)
27 if (derivs->array[i] < 0 || derivs->array[i] >=
nvars_)
29 ERROR(
"Weyl algebra: variable out of range");
32 if (comms->array[i] < 0 || comms->array[i] >=
nvars_)
34 ERROR(
"Weyl algebra: variable out of range");
63 D->mult(degx, degD, degxD);
64 if (not D->is_one(degxD))
79 D->mult(degh, degh, deg2h);
85 D->mult(degx, degD, degxD);
86 if (D->compare(deg2h, degxD) !=
EQ)
88 ERROR(
"Weyl algebra: failed to create homogeneous Weyl algebra");
107 result->initialize_poly_ring(K, M);
108 if (!
result->initialize_weyl(derivs, comms, homog_var))
return nullptr;
110#warning "hack for ZZ and QQ coeffs in Weyl algebra: clean it up?"
191 for (j = 1; j < i; j++)
204 for (j = 1; j <= i; j++)
231 if (bottom == 0)
return K_->from_long(1);
232 if (bottom == 1)
return K_->from_long(top);
235 for (
int a = 0; a < bottom; a++)
250 const int *bottom)
const
269 if (expbottom[i] > exptop[i])
return false;
274 const int *top_derivative)
const
277 while (current_derivative[i] == top_derivative[i])
285 for (
int j = 0; j < i; j++) current_derivative[j] = 0;
286 current_derivative[i]++;
291 int *result_derivatives)
const
299 int *result_exp)
const
308 const int *derivatives,
314 if (derivatives[i] == 0)
continue;
326 for (
int j = derivatives[i] - 1; j >= 0; j--)
341 const int *derivatives,
342 const Nterm *g)
const
361 for (i = 0; i <
nvars_; i++) deriv_exp[i] = 0;
367 sum += 2 * derivatives[i];
385 M_->to_expvector(t.monom, result_exp);
405 for (
int i2 = 0; i2 <
nvars_; i2++)
406 result_exp[i2] += expf[i2] - deriv_exp[i2];
407 M_->from_expvector(result_exp, tm->
monom);
430 M_->to_expvector(m, expf);
440 while (
increment(current_derivative, top_derivative));
461 const int *derivatives,
488 sum += 2 * derivatives[i];
506 GR->gbvector_get_lead_exponents(F, t, result_exp);
524 for (
int i2 = 0; i2 <
nvars_; i2++)
525 result_exp[i2] += expf[i2] - deriv_exp[i2];
528 GR->gbvector_term_exponents(F, b, result_exp, comp + t->comp);
555 M_->to_expvector(m, expf);
561 multinomial(c, top_derivative, current_derivative);
567 while (
increment(current_derivative, top_derivative));
579 for (
int i = 0; i <
nvars_; i++)
582 for (
int j = exptop[i]; j > exp[i]; j--)
601 return power(f, n1.second);
exponents::ConstExponents const_exponents
exponents::Exponents exponents_t
Dense exponent-vector template [e_0, ..., e_{nvars-1}] for monomial operations.
static GBRing * create_WeylAlgebra(const Ring *K0, const Monoid *M0, const WeylAlgebra *W0)
Polynomial-ring view tuned for the inner loop of classical Buchberger Groebner-basis computations.
Engine-side commutative monomial monoid: variable names, ordering, multidegree machinery,...
void setIsGraded(bool new_val)
virtual void remove(ring_elem &f) const =0
virtual ring_elem copy(const ring_elem f) const =0
virtual bool is_QQ() const
virtual ring_elem power(const ring_elem f, mpz_srcptr n) const
Exponentiation. This is the default function, if a class doesn't define this.
virtual ring_elem mult(const ring_elem f, const ring_elem g) const =0
const Monoid * degree_monoid() const
static std::pair< bool, int > get_si(mpz_srcptr n)
bool initialize_weyl(M2_arrayint derivs, M2_arrayint comms, int homog_var)
ring_elem diff_coefficients(const ring_elem c, const int *derivatives, const_exponents exp) const
void extractCommutativePart(const_exponents exp, int *result) const
gbvector * gbvector_weyl_diff(GBRing *GR, const ring_elem c, int comp, const_exponents expf, const int *derivatives, const FreeModule *Fg, const gbvector *g) const
ring_elem multinomial(const ring_elem a, const_exponents exptop, const_exponents expbottom) const
virtual ring_elem power(const ring_elem f, mpz_srcptr n) const
Exponentiation. This is the default function, if a class doesn't define this.
gbvector * gbvector_mult_by_term(gbvectorHeap &result, const gbvector *f, const ring_elem c, const_monomial m, int comp) const
void extractDerivativePart(const_exponents exp, int *result) const
virtual void text_out(buffer &o) const
bool _homogeneous_weyl_algebra
virtual ring_elem mult_by_term(const ring_elem f, const ring_elem c, const_monomial m) const
ring_elem binomial(int top, int bottom) const
Nterm * weyl_diff(const ring_elem c, const_exponents expf, const int *derivatives, const Nterm *g) const
bool divides(const_exponents expbottom, const_exponents exptop) const
bool increment(int *current_derivative, const int *top_derivative) const
static WeylAlgebra * create(const Ring *K, const Monoid *M, M2_arrayint derivs, M2_arrayint comms, int homog_var)
static int ** diffcoeffstable
GBRing and gbvector — the GB-tuned polynomial-ring view used by classical Buchberger code.
polyheap — polynomial-specialised geometric heap for reduction accumulators.
const int * const_monomial
VALGRIND_MAKE_MEM_DEFINED & result(result)
#define newarray_atomic_clear(T, len)
#define newarray_atomic(T, len)
Singly linked-list node carrying one term of a polynomial-ring element.
Text-formatting helpers layered on buffer: bignum print, line wrapping, M2_gbTrace-gated emit.
WeylAlgebra — ring of polynomial differential operators with [d_i, x_i] = 1.