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

◆ syzygy()

void PolyRing::syzygy ( const ring_elem a,
const ring_elem b,
ring_elem & x,
ring_elem & y ) const
virtual

Implements Ring.

Definition at line 1217 of file poly.cpp.

1221{
1222 // Do some special cases first. After that: compute a GB
1223
1224 // For the GB, we need to make a 1 by 2 matrix, and compute until one syzygy
1225 // is found.
1226 // create the matrix
1227 // create the gb comp
1228 // compute until one syz is found
1229 // grab the answer from the syz matrix.
1230
1231 // Special situations:
1232 if (PolyRing::is_equal(b, one()))
1233 {
1234 x = PolyRing::copy(b);
1235 y = PolyRing::negate(a);
1236 }
1237 else if (PolyRing::is_equal(b, minus_one()))
1238 {
1239 x = one();
1240 y = PolyRing::copy(a);
1241 }
1242 else
1243 {
1244#if 0
1245// // MES Aug 2002 ifdef'ed because gb_comp is not back yet
1246// intarray syzygy_stop_conditions;
1247// syzygy_stop_conditions.append(0); // ngb
1248// syzygy_stop_conditions.append(1); // nsyz
1249// syzygy_stop_conditions.append(0); // npairs
1250// syzygy_stop_conditions.append(0);
1251// syzygy_stop_conditions.append(0);
1252// syzygy_stop_conditions.append(0); // subring limit
1253// syzygy_stop_conditions.append(0);
1254//
1255// const FreeModule *F = make_FreeModule(1);
1256// Matrix *m = new Matrix(F);
1257// m->append(F->raw_term(a,0));
1258// m->append(F->raw_term(b,0));
1259// #if 0
1260// // buffer o;
1261// // o << "constructing syzygy on ";
1262// // elem_text_out(o,a);
1263// // o << " and ";
1264// // elem_text_out(o,b);
1265// // emit_line(o.str());
1266// // o.reset();
1267// // o << "matrix is" << newline;
1268// // m->text_out(o);
1269// // emit_line(o.str());
1270// // o.reset();
1271// #endif
1272//
1273// gb_comp *g = gb_comp::make(m,true,-1,0);
1274// g->calc(0, syzygy_stop_conditions);
1275// Matrix *s = g->syz_matrix();
1276//
1277// #if 0
1278// // if (s.n_cols() != 1)
1279// // {
1280// // o << "found " << s.n_cols() << " syzygies";
1281// // emit_line(o.str());
1282// // }
1283// #endif
1284// x = s->elem(0,0);
1285// y = s->elem(1,0);
1286// ring_elem c = preferred_associate(x);
1287// ring_elem x1 = mult(c,x);
1288// ring_elem y1 = mult(c,y);
1289// x = x1;
1290// y = y1;
1291// #if 0
1292// // o << "result: x = ";
1293// // elem_text_out(o,x);
1294// // o << " and y = ";
1295// // elem_text_out(o,y);
1296// // emit_line(o.str());
1297// #endif
1298// freemem(g);
1299#endif
1300 }
1301}
virtual bool is_equal(const ring_elem f, const ring_elem g) const
Definition poly.cpp:493
virtual ring_elem copy(const ring_elem f) const
Definition poly.cpp:653
virtual ring_elem negate(const ring_elem f) const
Definition poly.cpp:750
ring_elem one() const
Definition ring.hpp:357
ring_elem minus_one() const
Definition ring.hpp:358
volatile int x

References copy(), is_equal(), Ring::minus_one(), negate(), Ring::one(), and x.