1 #ifndef __MONOMIAL_IDEAL_HPP_ 2 #define __MONOMIAL_IDEAL_HPP_ 23 using std::cout;
using std::endl;
31 #include "system_constants.hpp" 34 #include "monomial.hpp" 35 #include "hilbert_functions.hpp" 36 #include "polynomial.hpp" 37 #include "skeleton.hpp" 47 virtual const char * what()
const throw() {
48 return "Monomials in list for monomial ideal need same number of variables";
64 const list<Monomial> & U,
const Monomial & t
86 n = nvars; hPol =
nullptr;
87 hNum = hRedNum = hGradNum = hGradRedNum =
nullptr;
88 current_grading =
nullptr;
96 NVAR_TYPE nvars,
const list<Monomial> & G,
98 const WT_TYPE * h_grading =
nullptr 102 if (g.num_vars() != n)
107 if (h_grading ==
nullptr) {
108 hNum = (h_old ==
nullptr) ?
nullptr 110 hRedNum = hGradNum = hGradRedNum =
nullptr;
112 hGradNum = (h_old ==
nullptr) ?
nullptr 114 hNum = hRedNum = hGradRedNum =
nullptr;
116 current_grading = h_grading;
124 NVAR_TYPE nvars,
const vector<Monomial> & G,
126 const WT_TYPE * h_grading =
nullptr 130 if (g.num_vars() != n)
135 if (h_grading ==
nullptr) {
136 hNum = (h_old ==
nullptr) ?
nullptr 138 hRedNum = hGradNum = hGradRedNum =
nullptr;
140 hGradNum = (h_old ==
nullptr) ?
nullptr 142 hNum = hRedNum = hGradRedNum =
nullptr;
144 current_grading = h_grading;
148 : n(I.n), gens(I.gens)
150 hNum = (I.
hNum ==
nullptr) ?
nullptr 152 hRedNum = (I.
hRedNum ==
nullptr) ?
nullptr 154 hGradNum = (I.
hGradNum ==
nullptr) ?
nullptr 158 hPol = (I.
hPol ==
nullptr) ?
nullptr 169 if (hPol !=
nullptr)
delete hPol;
170 if (hNum !=
nullptr)
delete hNum;
171 if (hRedNum !=
nullptr)
delete hRedNum;
172 if (hGradNum !=
nullptr)
delete hGradNum;
173 if (hGradRedNum !=
nullptr)
delete hGradRedNum;
184 unsigned size()
const {
return gens.size(); }
192 number_of_variables(), hilbert_numerator(), reduced_hilbert_numerator()
199 const WT_TYPE * grading =
nullptr 201 if (grading ==
nullptr) {
202 if (current_grading ==
nullptr and ibmap.size() > 0) {
207 current_grading =
nullptr;
210 if (current_grading == grading and ibmap.size() > 0) {
214 current_grading = grading;
228 const WT_TYPE * grading =
nullptr 231 if (grading ==
nullptr) {
234 else if (grading != current_grading) {
240 if (hGradNum ==
nullptr or grading != current_grading) {
241 if (grading != current_grading)
244 current_grading = grading;
260 const WT_TYPE * grading =
nullptr 263 if (grading ==
nullptr) {
264 if (hRedNum ==
nullptr)
266 number_of_variables(), hilbert_numerator()
270 if (hGradRedNum ==
nullptr or grading != current_grading) {
271 if (grading != current_grading)
274 number_of_variables(), hilbert_numerator(grading)
276 current_grading = grading;
278 result = hGradRedNum;
292 if (hPol ==
nullptr) {
294 number_of_variables(),
296 number_of_variables(),
297 hilbert_numerator(), reduced_hilbert_numerator()
301 reduced_hilbert_numerator()
335 hNum = hRedNum =
nullptr;
343 if (hNum !=
nullptr) {
346 J.forget_hilbert_numerator();
352 if (hRedNum !=
nullptr)
delete hRedNum;
353 if (hPol !=
nullptr)
delete hPol;
const map< DEG_TYPE, unsigned long > & inc_betti(const WT_TYPE *grading=nullptr)
incremental Betti numbers when adding the last Monomial in this ideal
Monomial_Ideal(NVAR_TYPE nvars, const vector< Monomial > &G, const Dense_Univariate_Integer_Polynomial *h_old=nullptr, const WT_TYPE *h_grading=nullptr)
Copies basis. If you supply a Hilbert function that is not computed according to the standard grading...
DEG_TYPE total_degree(NVAR_TYPE m=0) const
Sum of exponents of the first m variables.
Dense_Univariate_Integer_Polynomial * hGradNum
the ideal's Hilbert numerator, according to current_grading
A class for monomial ideals.
void multiply_by_monomial_of_degree(DEG_TYPE)
a hopefully efficient multiplication algorithm
Dense_Univariate_Rational_Polynomial * hilbert_polynomial(NVAR_TYPE n, unsigned int pole_order, const list< Monomial > T, Dense_Univariate_Integer_Polynomial *hn, Dense_Univariate_Integer_Polynomial *hn2)
computes the Hilbert polynomial for an ideal
map< DEG_TYPE, unsigned long > ibmap
the ideal's incremental Betti numbers
Dense_Univariate_Rational_Polynomial * hPol
the ideal's Hilbert polynomial – standard grading only
NVAR_TYPE number_of_variables() const
number of variables in each Monomial
const WT_TYPE * current_grading
the most recent grading for the Hilbert functions; nullptr implies standard grading ...
void remove_newest()
removes the newest monomial from the basis
unsigned size() const
number of generators
Dense_Univariate_Integer_Polynomial * hRedNum
the ideal's reduced Hilbert numerator, standard grading
Dense_Univariate_Integer_Polynomial * hilbert_second_numerator(NVAR_TYPE n, Dense_Univariate_Integer_Polynomial *first, const WT_TYPE *grading)
computes the second Hilbert numerator (after reduction by )
~Monomial_Ideal()
destroys the Hilbert data, but not the grading.
Monomial_Ideal * colon(const Monomial &t) const
returns the ideal , where is this
Dense_Univariate_Integer_Polynomial * hilbert_numerator_bigatti(const list< Monomial > &T, const WT_TYPE *grading)
the Bigatti algorithm to compute the Hilbert numerator
quick-’n-dirty Dense_Univariate integer polynomial class
map< DEG_TYPE, unsigned long > incremental_betti(const list< Monomial > &T, const WT_TYPE *grading)
Incremental Betti numbers for monomial ideals.
Dense_Univariate_Integer_Polynomial * hNum
the ideal's Hilbert numerator, standard grading
Dense_Univariate_Rational_Polynomial * hilbert_poly()
Dense_Univariate_Integer_Polynomial * hilbert_numerator(const WT_TYPE *grading=nullptr)
NVAR_TYPE n
number of variables the monomials of this ideal have
NVAR_TYPE num_vars() const
number of variables
list< Monomial > gens
the ideal's generators
Implementation of monomials.
unsigned dimension()
returns the dimension of the ideal
void forget_hilbert_numerator()
sets numerator to nullptr
void add_generator(const Monomial &t)
adds t to the basis
Dense_Univariate_Integer_Polynomial * hGradRedNum
the ideal's reduced Hilbert numerator, according to current_grading
void colon_with(const Monomial &t)
replaces the generators of this with those of the ideal , where is this
Monomial_Ideal(NVAR_TYPE nvars)
Creates a zero ideal.
Monomial_Ideal(NVAR_TYPE nvars, const list< Monomial > &G, const Dense_Univariate_Integer_Polynomial *h_old=nullptr, const WT_TYPE *h_grading=nullptr)
Copies basis. If you supply a Hilbert function that is not computed according to the standard grading...
void set_hilbert_numerator(Dense_Univariate_Integer_Polynomial *h)
sets numerator to given value; only use when you know this is true!
const list< Monomial > & generators() const
returns the list of generators
quick-’n-dirty Dense_Univariate rational polynomial class
list< Monomial > colon_ideal_without_ideals(const list< Monomial > &U, const Monomial &t)
Computes the generators of an ideal and a new generator, given the ideal's generators. No monomial ideal machinery required.
Monomial_Ideal(const Monomial_Ideal &I)
copy constructor
unsigned ideal_dimension(NVAR_TYPE n, const Dense_Univariate_Integer_Polynomial *h1, const Dense_Univariate_Integer_Polynomial *h2)
computes the dimension of the ideal by subtracting the Hilbert numerators
exceptions for Monomial Ideals
Dense_Univariate_Integer_Polynomial * reduced_hilbert_numerator(const WT_TYPE *grading=nullptr)
the reduced Hilbert Numerator