519{
520
521
522
523
524
525
526
527
528
529
531
532#if 0
533
534 if (coeffs.size() != exps.size())
535 fprintf(stderr, "size mismatch\n");
536 if (coeffs.size() != exps.size())
537 fprintf(stderr, "size mismatch2\n");
538 if (coeffs.size() != comps.size())
539 fprintf(stderr, "size mismatch3\n");
540#endif
541#if 0
542
543 fprintf(stderr, "-------------\n");
544 fprintf(stderr, "find_weak_generators %ld\n", coeffs.size());
545 for (size_t i = 0; i < coeffs.size(); i++)
546 T->show_weak(stderr, coeffs[i], exps[i], comps[i], i);
547#endif
548
550 positions.reserve(exps.size());
551 for (unsigned int i = 0; i < exps.size(); i++) positions.push_back(i);
552
553
554
555
556 if (use_stable_sort)
557 std::stable_sort(positions.begin(),
558 positions.end(),
559 montable_sorter_ZZ(nvars, coeffs, exps, comps));
560 else
561 std::sort(positions.begin(),
562 positions.end(),
563 montable_sorter_ZZ(nvars, coeffs, exps, comps));
564
565#if 0
566
567 fprintf(stderr, "sorted find_weak_generators\n");
568 for (size_t i = 0; i < coeffs.size(); i++)
569 T->show_weak(stderr, coeffs[i], exps[i], comps[i], positions[i]);
570#endif
571
572#if 0
573
574
575
576
577#endif
578
579 for (
VECTOR(
int)::iterator j = positions.begin(); j != positions.end(); j++)
580 if (!
T->is_weak_member(coeffs[*j], exps[*j], comps[*j]))
581 {
582 result_positions.push_back(*j);
583 T->insert(coeffs[*j], exps[*j], comps[*j], *j);
584 }
585
586#if 0
587
588 fprintf(stderr, "ones we take: find_weak_generators %ld\n", coeffs.size());
589 for (size_t i = 0; i < result_positions.size(); i++)
591 coeffs[result_positions[i]],
592 exps[result_positions[i]],
593 comps[result_positions[i]],
594 result_positions[i]);
595 fprintf(stderr, "\n\n");
596#endif
597
598
599}
static MonomialTableZZ * make(int nvars)