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

◆ pair_not_needed()

bool gbA::pair_not_needed ( spair * p,
gbelem * m )
private

Definition at line 594 of file gb-default.cpp.

595{
596 /* Check the criterion: in(m) divides lcm(p).
597 * If so: check if lcm(p1,m) == lcm(p) (if so, return false)
598 * check if lcm(p2,m) == lcm(p) (if so, return false)
599 * If still here, return true.
600 */
601 int i, first, second;
602 bool firstok;
603 exponents_t mexp, lcm, p1exp, p2exp;
604 if (p->type != SPAIR::SPAIR_SPAIR && p->type != SPAIR::SPAIR_RING)
605 return false;
606 mexp = m->lead;
607 lcm = p->lcm;
608 if (gbelem_COMPONENT(m) != spair_COMPONENT(p)) return false;
609
610 first = p->x.pair.i;
611 second = p->x.pair.j;
612 p1exp = gb[first]->lead;
613 p2exp =
614 gb[second]->lead; /* If a ring pair, this should index into gb array */
615
616 ncalls++;
617 for (i = 0; i < _nvars; i++, nloops++)
618 if (mexp[i] > lcm[i]) return false;
619
620 firstok = false;
621 for (i = 0; i < _nvars; i++)
622 {
623 if (mexp[i] == lcm[i]) continue;
624 if (p1exp[i] == lcm[i]) continue;
625 firstok = true;
626 break;
627 }
628 if (!firstok) return false;
629 for (i = 0; i < _nvars; i++)
630 {
631 if (mexp[i] == lcm[i]) continue;
632 if (p2exp[i] == lcm[i]) continue;
633 return true;
634 }
635 return false;
636}
exponents::Exponents exponents_t
int spair_COMPONENT(spair *s)
int _nvars
int gbelem_COMPONENT(gbelem *g)
@ SPAIR_SPAIR
@ SPAIR_RING
void gb(IntermediateBasis &F, int n)
static unsigned long nloops
static unsigned long ncalls
int p

References _nvars, gb(), gbelem_COMPONENT(), gbA::gbelem::lead, ncalls, nloops, p, spair_COMPONENT(), SPAIR_RING, and SPAIR_SPAIR.

Referenced by remove_unneeded_pairs().