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

◆ start_computation()

void HermiteComputation::start_computation ( )
virtual

Implements GBComputation.

Definition at line 260 of file hermite.cpp.

261{
262 // ngb = stop[0]
263 // nsyz = stop[1]
264 // npairs = stop[2]
265 if (status() == COMP_DONE) return;
266 for (; row >= 0; row--)
267 {
268 hm_elem *p = initial[row];
269 if (p == nullptr) continue;
270 initial[row] = nullptr;
271 sort(p); // This can remove elements, inserting them back
272 while (p != nullptr && p->next != nullptr)
273 {
274 hm_elem *pnext = p->next->next;
275 reduce(p, p->next); // replaces p1, and re-inserts p2.
276 p->next = pnext;
277 }
278 // At this point, 'p' is the only remaining element with this lead term
279 // So insert it into GB_list
280 p->next = GB_list;
281 GB_list = p;
282 n_gb++;
283 }
284 // At this point, we are done, so reset initial[...] (it is all NULL right
285 // now)
286
287 // Now let's auto reduce the result...
288 // We will reduce the GB elems
289 // one by one, placing them back into the 'initial' table.
290 // We use the following: the lead components of elements of GB_list are in
291 // increasing order
292
293 for (hm_elem *p = GB_list; p != nullptr; p = p->next)
294 {
295 if (!globalZZ->is_positive(p->f->coeff))
296 {
297 vec f = globalZZ->negate_vec(p->f);
298 vec fsyz = globalZZ->negate_vec(p->fsyz);
299 globalZZ->remove_vec(p->f);
300 globalZZ->remove_vec(p->fsyz);
301 p->f = f;
302 p->fsyz = fsyz;
303 }
304 gb_reduce(p->f, p->fsyz);
305 initial[p->f->comp] = p;
306 }
307
308 // for (hm_elem *p = GB_list; p != 0; p = p->next)
309 // initial[p->f->comp] = p;
311}
enum ComputationStatusCode status() const
Definition comp.hpp:100
enum ComputationStatusCode set_status(enum ComputationStatusCode)
Definition comp.cpp:66
void reduce(hm_elem *&p, hm_elem *q)
Definition hermite.cpp:210
void gb_reduce(vec &f) const
Definition hermite.cpp:387
hm_elem * GB_list
Definition hermite.hpp:63
void sort(hm_elem *&p)
Definition hermite.cpp:185
void remove_vec(vec v) const
vec negate_vec(vec v) const
int is_positive(const ring_elem a) const
Definition ZZ.cpp:177
@ COMP_DONE
Definition computation.h:60
RingZZ * globalZZ
Definition relem.cpp:13
int p

References COMP_DONE, GB_list, gb_reduce(), globalZZ, n_gb, p, reduce(), row, Computation::set_status(), sort(), and Computation::status().