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

◆ find_strong_generators()

void MonomialTableZZ::find_strong_generators ( int nvars,
const VECTOR(mpz_srcptr) & coeffs,
const VECTOR(exponents_t) & exps,
const VECTOR(int) & comps,
VECTOR(int) & result_positions )
static

Definition at line 601 of file montableZZ.cpp.

606{
607 // Find the set of terms c*exp*comp such that every other one is divisible
608 // by at least one of these.
609
610 VECTOR(int) positions;
611 positions.reserve(exps.size());
612 for (unsigned int i = 0; i < exps.size(); i++) positions.push_back(i);
613
614 /* The following sorts in ascending lex order, considering the component, exp
615 vector
616 and finally the coefficient */
617 std::stable_sort(positions.begin(),
618 positions.end(),
619 montable_sorter_ZZ(nvars, coeffs, exps, comps));
620
621#if 0
622// fprintf(stderr, "sorted terms: ");
623// for (int i=0; i<positions.size(); i++)
624// fprintf(stderr, "%d ", positions[i]);
625// fprintf(stderr, "\n");
626#endif
627
628 MonomialTableZZ *T = MonomialTableZZ::make(nvars);
629 for (VECTOR(int)::iterator j = positions.begin(); j != positions.end(); j++)
630 if (!T->is_strong_member(coeffs[*j], exps[*j], comps[*j]))
631 {
632 result_positions.push_back(*j);
633 T->insert(coeffs[*j], exps[*j], comps[*j], *j);
634 }
635 /* We could return T if that is desired */
636 // freemem(T);
637}
static MonomialTableZZ * make(int nvars)
#define VECTOR(T)
Definition newdelete.hpp:78
#define T
Definition table.c:13

References make(), T, and VECTOR.