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

◆ find_divisor()

int GBKernelComputation::find_divisor ( const MonomialIdeal * mi,
const_exponents exp,
int & result )
private

Definition at line 289 of file Eschreyer.cpp.

292{
293 // Find all the possible matches, use some criterion for finding the best...
295 this_mi->find_all_divisors(exp, bb);
296 int ndivisors = bb.size();
297 if (ndivisors == 0) return 0;
298 result = bb[0]->basis_elem();
299 // Now search through, and find the best one. If only one, just return it.
300 if (M2_gbTrace >= 5)
301 if (this_mi->size() > 1)
302 {
303 buffer o;
304 o << ":" << this_mi->size() << "." << ndivisors << ":";
305 emit(o.str());
306 }
307 if (ndivisors == 1)
308 {
309 if (this_mi->size() == 1)
310 n_ones++;
311 else
312 n_unique++;
313 return 1;
314 }
315 n_others++;
316
317 int lowest = result;
318 for (int i = 1; i < ndivisors; i++)
319 {
320 int p = bb[i]->basis_elem();
321 if (p < lowest) lowest = p;
322 }
323 result = lowest;
324 return ndivisors;
325}
int size()
Definition buffer.hpp:70
char * str()
Definition buffer.hpp:72
int p
VALGRIND_MAKE_MEM_DEFINED & result(result)
int M2_gbTrace
Definition m2-types.cpp:52
typename std::vector< T, gc_allocator< T > > gc_vector
a version of the STL vector, which allocates its backing memory with gc.
Definition newdelete.hpp:76
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(), and buffer::str().

Referenced by geo_reduce(), and reduce().