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

◆ find_divisor()

int res2_comp::find_divisor ( const MonomialIdeal * mi,
const int * exp,
res2_pair *& result )
private

Definition at line 1060 of file res-a0.cpp.

1063{
1064 // Find all the possible matches, use some criterion for finding the best...
1065 res2_pair *p;
1066 VECTOR(Bag *) bb;
1067 mi->find_all_divisors(exp, bb);
1068 if (bb.size() == 0) return 0;
1069 result = reinterpret_cast<res2_pair *>((bb[0]->basis_ptr()));
1070 // Now search through, and find the best one. If only one, just return it.
1071 if (M2_gbTrace >= 5)
1072 if (mi->size() > 1)
1073 {
1074 buffer o;
1075 o << ":" << mi->size() << "." << bb.size() << ":";
1076 emit(o.str());
1077 }
1078 if (bb.size() == 1)
1079 {
1080 if (mi->size() == 1)
1081 n_ones++;
1082 else
1083 n_unique++;
1084 return 1;
1085 }
1086 n_others++;
1087 // int n = R->n_terms(result->syz);
1088
1089 unsigned int lowest = result->pair_num;
1090 for (int i = 1; i < bb.size(); i++)
1091 {
1092 p = reinterpret_cast<res2_pair *>(bb[i]->basis_ptr());
1093 if (p->pair_num < lowest)
1094 {
1095 lowest = p->pair_num;
1096 result = p;
1097 }
1098#if 0
1099// int nt = R->n_terms(p->syz);
1100// if (nt < n)
1101// {
1102// n = nt;
1103// result = p;
1104// }
1105#endif
1106 }
1107 return 1;
1108}
void find_all_divisors(const_exponents exp, VECTOR(Bag *)&b) const
Definition monideal.cpp:246
int size() const
Definition monideal.hpp:186
char * str()
Definition buffer.hpp:72
int n_others
Definition res-a0.hpp:189
int n_unique
Definition res-a0.hpp:188
int n_ones
Definition res-a0.hpp:187
int p
int_bag Bag
Definition int-bag.hpp:70
VALGRIND_MAKE_MEM_DEFINED & result(result)
int M2_gbTrace
Definition m2-types.cpp:52
#define VECTOR(T)
Definition newdelete.hpp:78
void emit(const char *s)
Definition text-io.cpp:41

References emit(), MonomialIdeal::find_all_divisors(), M2_gbTrace, n_ones, n_others, n_unique, p, result(), MonomialIdeal::size(), buffer::str(), and VECTOR.

Referenced by reduce(), reduce2(), reduce3(), reduce4(), reduce_by_level(), and reduce_heap_by_level().