Macaulay2 Engine
Loading...
Searching...
No Matches
res-f4-monlookup.hpp
Go to the documentation of this file.
1// Copyright 1994-2016 Michael E. Stillman
2
3#ifndef _f4monlookup_h_
4#define _f4monlookup_h_
5
40
41#include "newdelete.hpp" // for VECTOR, our_ne...
42#include "schreyer-resolution/res-moninfo.hpp" // for ResMonoid
43#include "schreyer-resolution/res-monomial-types.hpp" // for res_varpower_m...
44class buffer; // lines 13-13
45class stash;
46
47class buffer;
48
49template <typename Key>
51{
55
59
62
63 struct mi_node : public our_new_delete // monomial ideal internal node ///
64 {
70 enum { node, leaf } tag;
71 union
72 {
73 mi_node *down; // 'up' node, if this is a head of a list
74 Key key;
75 } val;
76
77 public:
78 mi_node *&down() { return val.down; }
79 Key &key() { return val.key; }
81 {
82 q->header = header;
83 q->left = left;
84 q->right = this;
85 left = left->right = q;
86 }
87 };
88
91 int count;
92
93 int size_of_exp; // in ints, size of exp0
95 *exp0; // Always set to be all zeros, except during searches, inserts?
96 private:
100
101 void update_expvector(int topvar, const_varpower_monomial m);
103
104 bool find_one_divisor1(mi_node *mi,
106 Key &result_k) const;
107
110 VECTOR(Key) & result_k) const;
111
112 void insert1(mi_node *&p, const_varpower_monomial m, Key k);
113
114 public:
115 ResF4MonomialLookupTableT(int nvars, stash *mi_stash = nullptr);
117
118 // // Should we write these two routines?
119 // void insert_minimal_packed(const MonomialInfo *M,
120 // const_packed_monomial m,
121 // Key k);
122 // // It is assumed that 'm' is not already in the monomial ideal.
123 //
124 // bool insert_packed(const MonomialInfo *M,
125 // const_packed_monomial m,
126 // Key &k);
127 // // If m is already divisible by an element, return false, and set k
128 // // to be the key of that element.
129 // // If m is not divisible, then insert (m,k), and return true.
130
131 void insert_minimal_vp(long comp, const_varpower_monomial m, Key k);
132
133 bool insert_vp(long comp, const_varpower_monomial m, Key &k);
134
135 bool find_one_divisor_vp(long comp,
137 Key &result_k) const;
138
141 Key &result_k) const;
142 // Search. Return whether a monomial which divides 'm' is
143 // found. If so, return true, set the key.
144
145 void find_all_divisors_vp(long comp,
147 VECTOR(Key) & result_k) const;
148
151 VECTOR(Key) & result_k) const;
152 // Search. Return a vector of all keys corresponding to
153 // monomials which divide m.
154
155 void text_out(buffer &o) const;
156
157 int length() const { return count / 2; }
158 private:
159 mi_node *next(mi_node *p) const;
160 mi_node *prev(mi_node *p) const;
161
162 void do_node(mi_node *p, int indent, int disp) const;
163 void do_tree(mi_node *p, int depth, int indent, int disp) const;
164 int debug_check(mi_node *p, const mi_node *up) const;
165
166 void debug_out(int disp = 1) const;
167 void debug_check() const;
168};
169
171 elems,
172 VECTOR(int) & result_minimals,
173 stash *mi_stash = nullptr);
174
175#endif
176
177// Local Variables:
178// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
179// indent-tabs-mode: nil
180// End:
void insert_minimal_vp(long comp, const_varpower_monomial m, Key k)
res_const_ntuple_monomial const_ntuple_monomial
res_varpower_monomial varpower_monomial
void do_node(mi_node *p, int indent, int disp) const
void debug_out(int disp=1) const
void reset_expvector(const_varpower_monomial m)
void update_expvector(int topvar, const_varpower_monomial m)
void do_tree(mi_node *p, int depth, int indent, int disp) const
void text_out(buffer &o) const
mi_node * prev(mi_node *p) const
mi_node * next(mi_node *p) const
bool find_one_divisor_packed(const ResMonoid *M, const_packed_monomial m, Key &result_k) const
void find_all_divisors_vp(long comp, const_varpower_monomial m, VECTOR(Key) &result_k) const
res_const_packed_monomial const_packed_monomial
void find_all_divisors_packed(const ResMonoid *M, const_packed_monomial m, VECTOR(Key) &result_k) const
res_ntuple_monomial ntuple_monomial
ResF4MonomialLookupTableT(int nvars, stash *mi_stash=nullptr)
bool insert_vp(long comp, const_varpower_monomial m, Key &k)
bool find_one_divisor1(mi_node *mi, const_ntuple_monomial exp, Key &result_k) const
res_const_varpower_monomial const_varpower_monomial
void find_all_divisors1(mi_node *mi, const_ntuple_monomial exp, VECTOR(Key) &result_k) const
bool find_one_divisor_vp(long comp, const_varpower_monomial m, Key &result_k) const
res_packed_monomial packed_monomial
res_varpower_word varpower_word
mi_node * new_mi_node(varpower_word v, varpower_word e, mi_node *d)
void insert1(mi_node *&p, const_varpower_monomial m, Key k)
Definition mem.hpp:78
int p
#define VECTOR(T)
Definition newdelete.hpp:78
our_new_delete — per-class opt-in routing of new / delete through bdwgc.
void minimalize_res_varpower_monomials(const VECTOR(res_varpower_monomial) &elems, VECTOR(int) &result_minimals, stash *mi_stash=nullptr)
ResMonoidDense ResMonoid
ResMonoid dispatcher — single typedef switch between ResMonoidDense and ResMonoidSparse.
const res_varpower_word * res_const_varpower_monomial
res_varpower_word * res_varpower_monomial
res_ntuple_word * res_ntuple_monomial
res_ntuple_monomials::Exponent res_ntuple_word
const res_monomial_word * res_const_packed_monomial
res_varpower_monomials::Exponent res_varpower_word
res_monomial_word * res_packed_monomial
const res_ntuple_word * res_const_ntuple_monomial
Typed-monomial vocabulary shared by ResMonoid, ResPolyRing, SchreyerFrame, and F4Res.
enum ResF4MonomialLookupTableT::mi_node::@025031101115250154050127052044034126032125025377 tag
union ResF4MonomialLookupTableT::mi_node::@135211334355232135155254365222011221354240125150 val