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

◆ MonomialIdeal() [2/3]

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

Definition at line 102 of file monideal.cpp.

106 : R(R0), mi(nullptr), count(0), mi_stash(mi_stash0)
107{
108 if (mi_stash == nullptr)
109 {
110 count = 1;
111 mi_stash = new stash("mi_node", sizeof(Nmi_node));
112 }
113
114 // create a vector of <simple degree, index> for each element of 'elems'.
115 // sort them in increasing simple degree.
116 // then loop through, adding them in. This will insure that we only add in
117 // minimal generators.
118
119 std::vector<std::pair<int, int>> degs_and_indices;
120 int count = 0;
121 for (auto& b : elems)
122 {
123 int deg = varpower::simple_degree(b->monom().data());
124 degs_and_indices.push_back(std::make_pair(deg, count));
125 ++count;
126 }
127 std::stable_sort(degs_and_indices.begin(), degs_and_indices.end());
128
129 for (auto p : degs_and_indices)
130 {
131 Bag* b = elems[p.second];
132 Bag* b1; // not used here...
133 if (search(b->monom().data(), b1))
134 rejects.push_back(b);
135 else
137 }
138}
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().