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

◆ do_ideal()

void hilb_comp::do_ideal ( MonomialIdeal * I)
private

Definition at line 524 of file hilb.cpp.

525{
526 // This either will multiply to current->h1, or it will recurse down
527 // Notice that one, and minus_one are global in this class.
528 // LOCAL_deg1, LOCAL_vp are scratch variables defined in this class
529 nideal++;
530 ring_elem F = R->from_long(1);
531 ring_elem G;
532 int len = I->size();
533 if (len <= 2)
534 {
535 // len==1: set F to be 1 - t^(deg m), where m = this one element
536 // len==2: set F to be 1 - t^(deg m1) - t^(deg m2) + t^(deg lcm(m1,m2))
537 M->degree_of_varpower(I->first_elem(), LOCAL_deg1);
538 G = R->make_flat_term(minus_one, LOCAL_deg1);
539 R->add_to(F, G);
540
541 if (len == 2)
542 {
543 M->degree_of_varpower(I->second_elem(), LOCAL_deg1);
544 G = R->make_flat_term(minus_one, LOCAL_deg1);
545 R->add_to(F, G);
547 M->degree_of_varpower(LOCAL_vp.data(), LOCAL_deg1);
548 G = R->make_flat_term(one, LOCAL_deg1);
549 R->add_to(F, G);
550 }
551 delete I;
552 }
553 else
554 {
555 int npure;
556 gc_vector<int> pivot;
557 gc_vector<int> pure_a(I->topvar() + 1);
558 exponents_t pure = pure_a.data();
559 if (!find_pivot(*I, npure, pure, pivot))
560 {
561 // set F to be product(1-t^(deg x_i^e_i))
562 // - t^(deg pivot) product((1-t^(deg x_i^(e_i - m_i)))
563 // where e_i >= 1 is the smallest number s.t. x_i^(e_i) is in I,
564 // and m_i = exponent of x_i in pivot element (always < e_i).
565 M->degree_of_varpower(pivot.data(), LOCAL_deg1);
566 G = R->make_flat_term(one, LOCAL_deg1);
567 for (index_varpower i = pivot.data(); i.valid(); ++i)
568 if (pure[i.var()] != -1)
569 {
570 ring_elem H = R->from_long(1);
571 D->power(M->degree_of_var(i.var()), pure[i.var()], LOCAL_deg1);
572 ring_elem tmp = R->make_flat_term(minus_one, LOCAL_deg1);
573 R->add_to(H, tmp);
574 R->mult_to(F, H);
575 R->remove(H);
576
577 H = R->from_long(1);
578 D->power(M->degree_of_var(i.var()),
579 pure[i.var()] - i.exponent(),
580 LOCAL_deg1);
581 tmp = R->make_flat_term(minus_one, LOCAL_deg1);
582 R->add_to(H, tmp);
583 R->mult_to(G, H);
584 R->remove(H);
585 }
586 R->subtract_to(F, G);
587 delete I;
588 }
589 else
590 {
591 // This is the one case in which we recurse down
592 R->remove(F);
593 recurse(I, pivot.data());
594 return;
595 }
596 }
597 R->mult_to(current->h1, F);
598 R->remove(F);
599 current->i--;
600}
ExponentListIterator< int, true > index_varpower
exponents::Exponents exponents_t
static void lcm(ConstExponents a, ConstExponents b, Vector &result)
int size() const
Definition monideal.hpp:186
int topvar() const
Definition monideal.hpp:187
const_varpower second_elem() const
Definition monideal.cpp:182
const_varpower first_elem() const
Definition monideal.cpp:177
int nideal
Definition hilb.hpp:116
const Monoid * D
Definition hilb.hpp:97
ring_elem minus_one
Definition hilb.hpp:121
gc_vector< int > LOCAL_vp
Definition hilb.hpp:126
const PolynomialRing * R
Definition hilb.hpp:95
monomial LOCAL_deg1
Definition hilb.hpp:125
void recurse(MonomialIdeal *&I, const_varpower pivot_vp)
Definition hilb.cpp:500
hilb_step * current
Definition hilb.hpp:110
const Monoid * M
Definition hilb.hpp:96
ring_elem one
Definition hilb.hpp:120
static int find_pivot(const MonomialIdeal &I, int &npure, exponents_t pure, gc_vector< int > &m)
Definition hilb.cpp:236
tbb::flow::graph G

References current, D, find_pivot(), MonomialIdeal::first_elem(), G, ExponentList< int, true >::lcm(), LOCAL_deg1, LOCAL_vp, M, minus_one, nideal, one, R, recurse(), MonomialIdeal::second_elem(), MonomialIdeal::size(), and MonomialIdeal::topvar().

Referenced by step().