MCPcopy Create free account
hub / github.com/Singular/Singular / TestSimpleRingArithmetcs

Function TestSimpleRingArithmetcs

kernel/spectrum/test.cc:266–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264
265
266void TestSimpleRingArithmetcs()
267{
268 // Libpolys tests:
269
270 // construct the ring Z/32003[x,y,z]
271 // the variable names
272 char **n=(char**)omalloc(3*sizeof(char*));
273 n[0]=omStrDup("x");
274 n[1]=omStrDup("y");
275 n[2]=omStrDup("z2");
276
277 ring R = rDefault(32003,3,n); // ring R = rDefault(0,3,n);
278
279 rWrite(R); PrintLn();
280
281#ifdef RDEBUG
282 rDebugPrint(R);
283#endif
284
285
286 poly p = p_ISet(1,R); p_SetExp(p,1,1, R); p_Setm(p, R);
287
288 assume( p_GetExp(p,1, R) == 1 );
289
290 poly pp = pp_Mult_qq( p, p, R);
291
292 PrintS("p: "); p_Write0(p, R); Print(", deg(p): %ld", p_Totaldegree(p, R)); assume( 1 == p_Totaldegree(p, R) );
293
294 PrintS("; p*p : "); p_Write0(pp, R); Print("deg(pp): %ld\n", p_Totaldegree(pp, R)); assume( 2 == p_Totaldegree(pp, R) );
295
296
297 p_Delete(&p, R);
298
299 assume( p_GetExp(pp,1, R) == 2 );
300
301 p_Delete(&pp, R);
302
303
304// rDelete(R);
305
306 // make R the default ring:
307 rChangeCurrRing(R);
308
309 // create the polynomial 1
310 poly p1=pISet(1);
311
312 // create the polynomial 2*x^3*z^2
313 poly p2=p_ISet(2,R);
314 pSetExp(p2,1,3);
315 pSetExp(p2,3,2);
316 pSetm(p2);
317
318 // print p1 + p2
319 PrintS("p1: "); pWrite0(p1);
320 PrintS(" + p2: "); pWrite0(p2);
321 PrintS(" ---- >>>> ");
322
323 // compute p1+p2

Callers 1

mainFunction · 0.70

Calls 15

rWriteFunction · 0.85
rDebugPrintFunction · 0.85
p_ISetFunction · 0.85
p_SetExpFunction · 0.85
p_SetmFunction · 0.85
p_GetExpFunction · 0.85
pp_Mult_qqFunction · 0.85
PrintSFunction · 0.85
p_TotaldegreeFunction · 0.85
p_DeleteFunction · 0.85
rChangeCurrRingFunction · 0.85
pWrite0Function · 0.85

Tested by

no test coverage detected