89 positions.reserve(polys0.size());
91 for (
int i = 0; i < polys0.size(); i++) positions.push_back(i);
96 std::stable_sort(positions.begin(),
109 for (
VECTOR(
int)::iterator i = positions.begin(); i != positions.end(); i++)
114 R->gbvector_get_lead_exponents(
F, f, e);
115 if ((!
Rideal || !
Rideal->search_expvector(e, not_used)) &&
116 T->find_divisors(1, e, f->
comp) == 0)
123 h.
f =
R->gbvector_copy(f);
124 h.
fsyz =
R->gbvector_copy(polys0[*i].fsyz);
126 if (
false and auto_reduced)
129 R->gbvector_remove_content(h.
f, h.
fsyz);
135 R->exponents_delete(e);
138 for (
int i = 0; i < polys.size(); i++)
142 int d =
wt->gbvector_weight(f, f_lead_wt);
143 int a = d - f_lead_wt;
147 t.
size =
R->gbvector_n_terms(f);
149 gb_elems.push_back(t);
192 h_alpha = h_deg -
wt->exponents_weight(h_exp, h_comp);
194 int n0 = (ringtable ? ringtable->
find_divisors(-1, h_exp, 1, &divisors) : 0);
195 int n1 =
T1->find_divisors(-1, h_exp, h_comp, &divisors);
196 int n2 =
T->find_divisors(-1, h_exp, h_comp, &divisors);
198 if (n == 0)
return false;
205 for (
int i = 0; i < n0; i++)
207 int id = divisors[i]->_val;
208 div_info[next++] = ring_elems[id];
211 for (
int i = 0; i < n1; i++)
213 int id = divisors[n0 + i]->_val;
214 div_info[next++] = new_poly_elems[id];
217 for (
int i = 0; i < n2; i++)
219 int id = divisors[n0 + n1 + i]->_val;
220 div_info[next++] = gb_elems[id];
226 o <<
"\nfind good divisor:";
229 o <<
"\n ndivisors from quotient ring elements " << n0;
230 for (
int j = 0; j < n0; j++)
233 o <<
"\n size " << t.
size <<
" alpha " << t.
alpha <<
" lead ";
235 R->gbvector_text_out(o,
F, f);
236 R->gbvector_remove(f);
241 o <<
"\n ndivisors from appended elements " << n1;
242 for (
int j = 0; j < n1; j++)
245 o <<
"\n size " << t.
size <<
" alpha " << t.
alpha <<
" lead ";
247 R->gbvector_text_out(o,
F, f);
248 R->gbvector_remove(f);
253 o <<
"\n ndivisors from gb elements " << n1;
254 for (
int j = 0; j < n2; j++)
257 o <<
"\n size " << t.
size <<
" alpha " << t.
alpha <<
" lead ";
259 R->gbvector_text_out(o,
F, f);
260 R->gbvector_remove(f);
268 int min_alpha = div_info[0].
alpha;
269 for (
int i = 1; i < n; i++)
270 if (div_info[i].alpha < min_alpha) min_alpha = div_info[i].
alpha;
271 result_g_alpha = min_alpha;
277 for (
int i = 0; i < n; i++)
279 if (div_info[i].alpha == min_alpha)
281 int this_size = div_info[i].
size;
282 if (min_size < 0 || this_size < min_size)
284 min_size = this_size;
288 else if (this_size == min_size)
303 assert(result_i >= 0);
304 result_g = div_info[result_i].
g;
309 if (nmatches > 1) o <<
"\n nmatches " << n;
310 o <<
"\n chosen value: ";
311 int size =
R->gbvector_n_terms(result_g.
f);
312 o <<
"\n size " << size <<
" alpha " << result_g_alpha <<
" lead ";
313 gbvector *f =
R->gbvector_lead_term(-1,
F, result_g.
f);
314 R->gbvector_text_out(o,
F, f);
315 R->gbvector_remove(f);
332 for (
int i=0; i<divisors.size(); i++)
337 int g_alpha = ring_alpha[id];
338 if (g_alpha <= h_alpha)
341 result_g_alpha = g_alpha;
344 if (min_alpha < 0 || g_alpha < min_alpha)
348 result_g_alpha = g_alpha;
358 o <<
"\nfind good divisor:";
363 n =
T1->find_divisors(-1, h_exp, h_comp, &divisors);
370 o <<
"\n ndivisors from appended elements " << n;
371 for (
int j=0; j<n; j++)
376 int g_alpha = newpol_alpha[id];
377 int size =
R->gbvector_n_terms(
p.f);
378 o <<
"\n size " << size <<
" alpha " << g_alpha <<
" lead ";
380 R->gbvector_text_out(o,
F,f);
384 for (
int i=0; i<divisors.size(); i++)
389 int g_alpha = newpol_alpha[id];
390 if (result_g_alpha < 0 && g_alpha <= h_alpha)
393 result_g_alpha = g_alpha;
397 if (min_alpha < 0 || g_alpha < min_alpha)
401 result_g_alpha = g_alpha;
408 n =
T->find_divisors(-1, h_exp, h_comp, &divisors);
415 o <<
"\n ndivisors from GB " << n;
416 for (
int j=0; j<n; j++)
421 int g_alpha = alpha[id];
422 int size =
R->gbvector_n_terms(
p.f);
423 o <<
"\n size " << size <<
" alpha " << g_alpha <<
" lead ";
425 R->gbvector_text_out(o,
F,f);
430 for (
int i=0; i<divisors.size(); i++)
435 int g_alpha = alpha[id];
436 if (result_g_alpha < 0 && g_alpha <= h_alpha)
439 result_g_alpha = g_alpha;
444 if (min_alpha < 0 || g_alpha < min_alpha)
448 result_g_alpha = g_alpha;
458 o <<
"\n chosen value: ";
459 int size =
R->gbvector_n_terms(result_g.
f);
460 o <<
"\n size " << size <<
" alpha " << result_g_alpha <<
" lead ";
461 gbvector *f =
R->gbvector_lead_term(-1,
F,result_g.
f);
462 R->gbvector_text_out(o,
F,f);
463 R->gbvector_remove(f);
467 return (min_alpha >= 0);
void emit_wrapped(const char *s)
Text-formatting helpers layered on buffer: bignum print, line wrapping, M2_gbTrace-gated emit.