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

◆ reduce_kk()

bool gbA::reduce_kk ( spair * p)
private

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

1360{
1361 /* Returns false iff we defer computing this spair. */
1362 /* If false is returned, this routine has grabbed the spair 'p'. */
1363 int tmf, wt;
1364 int count = -1;
1365
1367
1368 if (M2_gbTrace == 15)
1369 {
1370 buffer o;
1371 o << "considering ";
1372 spair_text_out(o, p);
1373 o << " : ";
1374 emit_line(o.str());
1375 }
1376 compute_s_pair(p); /* Changes the type, possibly */
1377
1378 while (!R->gbvector_is_zero(p->f()))
1379 {
1380 if (count++ > max_reduction_count)
1381 {
1383 return false;
1384 }
1385 if (M2_gbTrace >= 5)
1386 {
1387 if ((wt = weightInfo_->gbvector_weight(p->f(), tmf)) > this_degree)
1388 {
1389 buffer o;
1390 o << "ERROR: degree of polynomial is too high: deg " << wt
1391 << " termwt " << tmf << " expectedeg " << this_degree
1392 << newline;
1393 emit(o.str());
1394 }
1395 }
1396
1397 int gap, w;
1398 R->gbvector_get_lead_exponents(_F, p->f(), EXP);
1399 int x = p->f()->comp;
1400 w = find_good_divisor(EXP, x, this_degree, gap);
1401
1402 // replaced gap, g.
1403 if (w < 0) break;
1404 if (gap > 0)
1405 {
1406 POLY h;
1407 h.f = R->gbvector_copy(p->x.f.f);
1408 h.fsyz = R->gbvector_copy(p->x.f.fsyz);
1409 insert_gb(h, (p->type == SPAIR::SPAIR_GEN ? ELEM_MINGEN : 0));
1410 }
1411 POLY g = gb[w]->g;
1412
1413 R->gbvector_reduce_lead_term(_F,
1414 _Fsyz,
1415 nullptr,
1416 p->f(),
1417 p->fsyz(), /* modifies these */
1418 g.f,
1419 g.fsyz);
1420
1422 if (M2_gbTrace == 15)
1423 {
1424 buffer o;
1425 o << " reducing by g" << w;
1426 o << ", yielding ";
1427 R->gbvector_text_out(o, _F, p->f(), 3);
1428 emit_line(o.str());
1429 }
1430 if (R->gbvector_is_zero(p->f())) break;
1431 if (gap > 0)
1432 {
1433 p->deg += gap;
1434 if (M2_gbTrace == 15)
1435 {
1436 buffer o;
1437 o << " deferring to degree " << p->deg;
1438 emit_line(o.str());
1439 }
1441 return false;
1442 }
1443 }
1444 if (M2_gbTrace >= 4 && M2_gbTrace != 15)
1445 {
1446 buffer o;
1447 o << "." << count;
1448 emit_wrapped(o.str());
1449 }
1450 return true;
1451}
exponents::Exponents exponents_t
char * str()
Definition buffer.hpp:72
void compute_s_pair(spair *p)
void spair_text_out(buffer &o, spair *p)
GBRing * R
void spair_set_insert(spair *p)
long max_reduction_count
int stats_nreductions
int find_good_divisor(exponents_t e, int x, int degf, int &result_gap)
const GBWeight * weightInfo_
const FreeModule * _F
const FreeModule * _Fsyz
int this_degree
void insert_gb(POLY f, gbelem_type minlevel)
@ SPAIR_GEN
void spair_set_defer(spair *&p)
size_t exp_size
void gb(IntermediateBasis &F, int n)
const int ELEM_MINGEN
int p
char newline[]
Definition m2-types.cpp:49
int M2_gbTrace
Definition m2-types.cpp:52
#define ALLOCATE_EXPONENTS(byte_len)
Definition monoid.hpp:62
volatile int x
#define POLY(q)
Definition poly.cpp:23
gbvector * fsyz
Definition gbring.hpp:99
gbvector * f
Definition gbring.hpp:98
void emit_wrapped(const char *s)
Definition text-io.cpp:27
void emit_line(const char *s)
Definition text-io.cpp:47
void emit(const char *s)
Definition text-io.cpp:41

References _F, _Fsyz, ALLOCATE_EXPONENTS, compute_s_pair(), ELEM_MINGEN, emit(), emit_line(), emit_wrapped(), exp_size, POLY::f, find_good_divisor(), POLY::fsyz, gb(), insert_gb(), M2_gbTrace, max_reduction_count, newline, p, POLY, R, SPAIR_GEN, spair_set_defer(), spair_set_insert(), spair_text_out(), stats_nreductions, buffer::str(), this_degree, weightInfo_, and x.

Referenced by reduceit().