Macaulay2 Engine
Loading...
Searching...
No Matches

◆ MonomialIdeal() [3/3]

MonomialIdeal::MonomialIdeal ( const PolynomialRing * R0,
VECTOR(Bag *) & elems,
stash * mi_stash0 = nullptr )

Definition at line 140 of file monideal.cpp.

143 : R(R0), mi(nullptr), count(0), mi_stash(mi_stash0)
144{
145 if (mi_stash == nullptr)
146 {
147 count = 1;
148 mi_stash = new stash("mi_node", sizeof(Nmi_node));
149 }
150
151 // create a vector of <simple degree, index> for each element of 'elems'.
152 // sort them in increasing simple degree.
153 // then loop through, adding them in. This will insure that we only add in
154 // minimal generators.
155
156 std::vector<std::pair<int, int>> degs_and_indices;
157 int count = 0;
158 for (auto& b : elems)
159 {
160 int deg = varpower::simple_degree(b->monom().data());
161 degs_and_indices.push_back(std::make_pair(deg, count));
162 ++count;
163 }
164 std::stable_sort(degs_and_indices.begin(), degs_and_indices.end());
165
166 for (auto p : degs_and_indices)
167 {
168 Bag* b = elems[p.second];
169 Bag* b1; // not used here...
170 if (search(b->monom().data(), b1))
171 delete b;
172 else
174 }
175}
static Exponent simple_degree(ConstExponents m)
int search(const_varpower m, Bag *&b) const
Definition monideal.cpp:278
void insert_minimal(Bag *b)
Definition monideal.hpp:333
const PolynomialRing * R
Definition monideal.hpp:137
Nmi_node * mi
Definition monideal.hpp:138
stash * mi_stash
Definition monideal.hpp:142
gc_vector< int > & monom()
Definition int-bag.hpp:60
int p
int_bag Bag
Definition int-bag.hpp:70

References count, insert_minimal(), mi, mi_stash, int_bag::monom(), p, R, search(), and ExponentList< int, true >::simple_degree().