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

◆ replace_gb_element_ZZ()

void gbA::replace_gb_element_ZZ ( MonomialTableZZ::mon_term * t)
private

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

2235{
2236 /* Reduce this element as far as possible. This either removes content,
2237 makes it monic, or at least negates it so the lead coeff is positive. */
2238 ring_elem not_used;
2239
2240 stats_ngb++;
2241 n_gb++;
2242
2243 int gbval = t->_val;
2244 gbelem *g = gb[gbval];
2245 gb[gbval] = nullptr;
2246
2247 g->deg = this_degree; // replace the degree
2248 g->minlevel |= ELEM_MINGB;
2249 minimal_gb_valid = false;
2250 int me = INTSIZE(gb);
2251
2252 if (is_local_gb)
2253 R->gbvector_remove_content(g->g.f, g->g.fsyz, false, not_used);
2254 else
2256
2257 // tail_remainder_ZZ(g->g,this_degree);
2258 gb.push_back(g);
2259 forwardingZZ.push_back(-1);
2260 forwardingZZ[gbval] = INTSIZE(gb) - 1;
2261
2262 lookupZZ->change_coefficient(t, g->g.f->coeff.get_mpz(), me);
2263 if (M2_gbTrace == 15)
2264 {
2265 buffer o;
2266 o << " retiring g" << gbval << " with new ";
2267 // o << " new ";
2268 gbelem_text_out(o, INTSIZE(gb) - 1);
2269
2270 emit_line(o.str());
2271 }
2272 else if (M2_gbTrace >= 5)
2273 {
2274 const int N = 100;
2275 char s[N];
2276 buffer o;
2277 snprintf(s, N,
2278 "replacing-inserting element %d (minimal %d replacing %d): ",
2279 me,
2280 g->minlevel,
2281 gbval);
2282 o << s;
2283 R->gbvector_text_out(o, _F, g->g.f);
2284 emit_line(o.str());
2285 o.reset();
2286 o << " syzygy : ";
2287 R->gbvector_text_out(o, _Fsyz, g->g.fsyz);
2288 emit_line(o.str());
2289 }
2290
2291 if (!is_local_gb) auto_reduce_by(me);
2292}
char * str()
Definition buffer.hpp:72
void reset()
Definition buffer.hpp:69
GBRing * R
int stats_ngb
void tail_remainder_ZZ(POLY &f, int degf)
MonomialTableZZ * lookupZZ
int n_gb
void gbelem_text_out(buffer &o, int i, int nterms=3) const
void auto_reduce_by(int id)
const FreeModule * _F
const FreeModule * _Fsyz
int this_degree
bool is_local_gb
bool minimal_gb_valid
void gb(IntermediateBasis &F, int n)
const int ELEM_MINGB
void size_t s
Definition m2-mem.cpp:271
int M2_gbTrace
Definition m2-types.cpp:52
GBF4Polynomial f
Definition f4-types.hpp:139
int deg
Definition f4-types.hpp:140
gbelem_type minlevel
Definition f4-types.hpp:142
#define INTSIZE(a)
Definition style.hpp:37
void emit_line(const char *s)
Definition text-io.cpp:47

References _F, _Fsyz, MonomialTableZZ::mon_term::_val, auto_reduce_by(), gbvector::coeff, gbA::gbelem::deg, ELEM_MINGB, emit_line(), POLY::f, POLY::fsyz, gbA::gbelem::g, gb(), gbelem_text_out(), ring_elem::get_mpz(), INTSIZE, is_local_gb, lookupZZ, M2_gbTrace, minimal_gb_valid, gbA::gbelem::minlevel, n_gb, R, buffer::reset(), s, stats_ngb, buffer::str(), tail_remainder_ZZ(), and this_degree.

Referenced by reduce_ZZ().