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

◆ step()

int hilb_comp::step ( )
private

Definition at line 446 of file hilb.cpp.

448{
449 nsteps++;
450 if (current->i == current->first_sum)
451 {
452 current->h0 = current->h1;
453 current->h1 = R->from_long(1);
454 }
455 if (current->i >= 0)
456 {
457 // If the i th monomial ideal is a 'special case', simply compute its
458 // value
459 // Otherwise, find pivot, and quotient/sum creating next level down
460 // (possibly make new hilb_step, and increment max_depth if needed)
461 // and set current = current->down
462 do_ideal(current->monids[current->i]); // consumes this monomial ideal
463 }
464 else
465 {
466 // At this point, all Hilbert functions at this level have been
467 // computed, so add the values, and place one step up
468 R->add_to(current->h0, current->h1);
469 ring_elem f = current->h0;
470 current->h0 = R->from_long(0);
471 current->h1 = R->from_long(0);
472 current->monids.clear();
473 if (current->up == nullptr)
474 {
475 if (input_mat)
476 {
477 ring_elem tmp =
478 R->make_flat_term(one, input_mat->rows()->degree(this_comp));
479 R->mult_to(f, tmp);
480 R->remove(tmp);
481 }
482 R->add_to(result_poincare, f);
483 this_comp++;
484
485 // Now check if we have any more components
486 if (this_comp >= n_components) return COMP_DONE;
487 // otherwise go on to the next component:
488
490 return COMP_COMPUTING;
491 }
492 current = current->up;
493 R->mult_to(current->h1, f);
494 current->i--;
495 R->remove(f);
496 }
497 return COMP_COMPUTING;
498}
void do_ideal(MonomialIdeal *I)
Definition hilb.cpp:524
ring_elem result_poincare
Definition hilb.hpp:103
const Matrix * input_mat
Definition hilb.hpp:102
const PolynomialRing * R
Definition hilb.hpp:95
void next_monideal()
Definition hilb.cpp:314
hilb_step * current
Definition hilb.hpp:110
int nsteps
Definition hilb.hpp:113
int n_components
Definition hilb.hpp:106
int this_comp
Definition hilb.hpp:105
ring_elem one
Definition hilb.hpp:120
@ COMP_DONE
Definition computation.h:60
@ COMP_COMPUTING
Definition computation.h:71

References COMP_COMPUTING, COMP_DONE, current, do_ideal(), input_mat, n_components, next_monideal(), nsteps, one, R, result_poincare, and this_comp.

Referenced by calc().