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

◆ do_pairs_by_level()

enum ComputationStatusCode res2_comp::do_pairs_by_level ( int level)

Definition at line 151 of file res-a0.cpp.

152{
153 // The pairs should be sorted in ascending monomial order
154
155 res2_pair *p;
156
157 if (M2_gbTrace >= 2)
158 {
159 int nelems = resn[level]->nleft;
160 if (nelems > 0)
161 {
162 buffer o;
163 o << "[lev " << nelems << ']';
164 emit(o.str());
165 }
166 }
167 for (p = resn[level]->next_pair; p != nullptr; p = p->next)
168 {
169 resn[level]->next_pair = p->next;
171 if (stop_.pair_limit > 0 && npairs - nleft >= stop_.pair_limit)
173 // if (--PairLimit == 0) return COMP_DONE_PAIR_LIMIT;
175 }
176
177 if (do_by_level == 2)
178 {
179 // The following is experimental
180 // Remove any term that cannot appear as a lead term.
181 // This destroys the resolution as we go, so in general, we would have
182 // to place this information elsewhere.
183 int nmonoms = 0;
184 int nkilled = 0;
185 for (p = resn[level]->pairs; p != nullptr; p = p->next)
186 {
187 res2term *f = p->syz;
188 res2term head;
189 res2term *g = &head;
190 for (f = p->syz; f != nullptr; f = f->next)
191 {
192 if (f->comp->mi->size() > 0)
193 {
194 g->next = R->new_term(K->copy(f->coeff), f->monom, f->comp);
195 g = g->next;
196 nmonoms++;
197 }
198 else
199 nkilled++;
200 }
201 g->next = nullptr;
202 p->pivot_term = head.next;
203 }
204 if (M2_gbTrace >= 3)
205 {
206 buffer o;
207 o << "[kept " << nmonoms << " killed " << nkilled << "]";
208 emit(o.str());
209 }
210 }
211 return COMP_COMPUTING;
212}
StopConditions stop_
Definition comp.hpp:75
int size() const
Definition monideal.hpp:186
char * str()
Definition buffer.hpp:72
res2_poly * R
Definition res-a0.hpp:123
void handle_pair_by_level(res2_pair *p)
Definition res-a0.cpp:1727
int npairs
Definition res-a0.hpp:182
int nleft
Definition res-a0.hpp:181
const Ring * K
Definition res-a0.hpp:125
unsigned char do_by_level
Definition res-a0.hpp:173
@ COMP_DONE_PAIR_LIMIT
Definition computation.h:64
@ COMP_COMPUTING
Definition computation.h:71
@ COMP_INTERRUPTED
Definition computation.h:57
int p
bool system_interrupted()
int M2_gbTrace
Definition m2-types.cpp:52
MonomialIdeal * mi
res2term * next
res2_pair * comp
ring_elem coeff
int monom[1]
void emit(const char *s)
Definition text-io.cpp:41

References res2term::coeff, res2term::comp, COMP_COMPUTING, COMP_DONE_PAIR_LIMIT, COMP_INTERRUPTED, do_by_level, emit(), handle_pair_by_level(), K, M2_gbTrace, res2_pair::mi, res2term::monom, res2term::next, nleft, npairs, p, R, MonomialIdeal::size(), Computation::stop_, buffer::str(), and system_interrupted().

Referenced by start_computation().