Macaulay2 Engine
Loading...
Searching...
No Matches
f4-monlookup.hpp
Go to the documentation of this file.
1// (c) 1994-2021 Michael E. Stillman
2
3#ifndef _f4monlookup_h_
4#define _f4monlookup_h_
5
47
48#include "f4/moninfo.hpp" // for MonomialInfo (ptr only), const_p...
49#include "f4/ntuple-monomial.hpp" // for const_ntuple_monomial, ntuple_word
50#include "f4/varpower-monomial.hpp" // for const_varpower_monomial, varpowe...
51
52class buffer;
53
54template <typename Key>
56{
57 struct mi_node // monomial ideal internal node ///
58 {
64 enum { node, leaf } tag;
65 union
66 {
67 mi_node *down; // 'up' node, if this is a head of a list
68 Key key;
69 } val;
70
71 public:
72 mi_node *&down() { return val.down; }
73 Key &key() { return val.key; }
75 {
76 q->header = header;
77 q->left = left;
78 q->right = this;
79 left = left->right = q;
80 }
81 };
82
83 std::vector<mi_node *> mis;
84 int count;
85
86 int size_of_exp; // in ints, size of exp0
88 *exp0; // Always set to be all zeros, except during searches, inserts?
89 private:
90 mi_node *new_mi_node(varpower_word v, varpower_word e, mi_node *d);
92 void delete_mi_node(mi_node *p);
93
96
97 bool find_one_divisor1(mi_node *mi,
99 Key &result_k) const;
100
101 void find_all_divisors1(mi_node *mi,
103 std::vector<Key>& result_k) const;
104
105 void insert1(mi_node *&p, const_varpower_monomial m, Key k);
106
107 public:
110
111 // // Should we write these two routines?
112 // void insert_minimal_packed(const MonomialInfo *M,
113 // const_packed_monomial m,
114 // Key k);
115 // // It is assumed that 'm' is not already in the monomial ideal.
116 //
117 // bool insert_packed(const MonomialInfo *M,
118 // const_packed_monomial m,
119 // Key &k);
120 // // If m is already divisible by an element, return false, and set k
121 // // to be the key of that element.
122 // // If m is not divisible, then insert (m,k), and return true.
123
125
126 bool insert_vp(long comp, const_varpower_monomial m, Key &k);
127
128 bool find_one_divisor_vp(long comp,
130 Key &result_k) const;
131
134 Key &result_k) const;
135 // Search. Return whether a monomial which divides 'm' is
136 // found. If so, return true, set the key.
137
138 void find_all_divisors_vp(long comp,
140 std::vector<Key> & result_k) const;
141
144 std::vector<Key> & result_k) const;
145 // Search. Return a vector of all keys corresponding to
146 // monomials which divide m.
147
148 void text_out(buffer &o) const;
149
150 int length() const { return count / 2; }
151 private:
152 mi_node *next(mi_node *p) const;
153 mi_node *prev(mi_node *p) const;
154
155 void do_node(mi_node *p, int indent, int disp) const;
156 void do_tree(mi_node *p, int depth, int indent, int disp) const;
157 int debug_check(mi_node *p, const mi_node *up) const;
158
159 void debug_out(int disp = 1) const;
160 void debug_check() const;
161};
162
163void minimalize_varpower_monomials(const std::vector<varpower_monomial> & elems,
164 std::vector<int> & result_minimals);
165
166#endif
167
168// Local Variables:
169// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
170// indent-tabs-mode: nil
171// End:
void reset_expvector(const_varpower_monomial m)
mi_node * next(mi_node *p) const
void update_expvector(int topvar, const_varpower_monomial m)
void text_out(buffer &o) const
bool find_one_divisor_packed(const MonomialInfo *M, const_packed_monomial m, Key &result_k) const
int debug_check(mi_node *p, const mi_node *up) const
void do_node(mi_node *p, int indent, int disp) const
bool insert_vp(long comp, const_varpower_monomial m, Key &k)
void do_tree(mi_node *p, int depth, int indent, int disp) const
mi_node * new_mi_node(varpower_word v, varpower_word e, Key k)
bool find_one_divisor1(mi_node *mi, const_ntuple_monomial exp, Key &result_k) const
mi_node * new_mi_node(varpower_word v, varpower_word e, mi_node *d)
void debug_out(int disp=1) const
F4MonomialLookupTableT(int nvars)
void insert_minimal_vp(long comp, const_varpower_monomial m, Key k)
void find_all_divisors_vp(long comp, const_varpower_monomial m, std::vector< Key > &result_k) const
void delete_mi_node(mi_node *p)
std::vector< mi_node * > mis
mi_node * prev(mi_node *p) const
void find_all_divisors1(mi_node *mi, const_ntuple_monomial exp, std::vector< Key > &result_k) const
void find_all_divisors_packed(const MonomialInfo *M, const_packed_monomial m, std::vector< Key > &result_k) const
void insert1(mi_node *&p, const_varpower_monomial m, Key k)
bool find_one_divisor_vp(long comp, const_varpower_monomial m, Key &result_k) const
Per-ring monomial layout / encoding helper used by F4GB.
Definition moninfo.hpp:108
void minimalize_varpower_monomials(const std::vector< varpower_monomial > &elems, std::vector< int > &result_minimals)
int p
const monomial_word * const_packed_monomial
Definition moninfo.hpp:79
MonomialInfo — F4's packed_monomial encoding plus operations.
ntuple_monomials::Exponent ntuple_word
const ntuple_word * const_ntuple_monomial
F4's dense int64_t exponent-vector specialisation of ExponentVector (legacy).
union F4MonomialLookupTableT::mi_node::@275361037347002122310232014171022201144232123300 val
enum F4MonomialLookupTableT::mi_node::@106101245262356146223070047151024177106047314172 tag
const varpower_word * const_varpower_monomial
varpower_monomials::Exponent varpower_word
F4's (variable, exponent) sparse-monomial ExponentList specialisation (legacy).