Changeset 78eaa8 in git
- Timestamp:
- Jul 24, 2019, 1:39:31 PM (4 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
- Children:
- 20e7303a3d50b30117c53a232ad724297637ac0e
- Parents:
- fa1cd304b94fb2782b47874564b731a57670c34ccbb89a79113ccf8c4cf31dd700cba8927fe3623a
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2019-07-24 13:39:31+02:00
- git-committer:
- GitHub <noreply@github.com>2019-07-24 13:39:31+02:00
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/algebra.lib
rfa1cd3 r78eaa8 1032 1032 } 1033 1033 // --------------------- change of variable names ------------------------- 1034 execute("ring @bsr = ("+charstr(bsr)+"),y(1..m),("+os+");"); 1034 list l2; 1035 for (int ii = 1; ii <= m; ii++) 1036 { 1037 l2[ii] = "y("+string(ii)+")"; 1038 } 1039 ring @bsr = create_ring(ringlist(bsr)[1], l2, "("+os+")", "no_minpoly"); 1035 1040 ideal J = fetch(bsr,J); 1036 1041 ideal PHI = fetch(bsr,PHI); -
Singular/LIB/assprimeszerodim.lib
rfa1cd3 r78eaa8 364 364 //=== mapping T to p and test if d=deg(F) 365 365 def R = basering; 366 execute("ring Rhelp = ("+charstr(R)+"), T, dp;");366 ring Rhelp = create_ring(ringlist(R)[1], "T", "dp", "no_minpoly"); 367 367 setring R; 368 368 map phi = Rhelp,p; -
Singular/LIB/chern.lib
rfa1cd3 r78eaa8 3305 3305 int n=nvars(basering); 3306 3306 def br@=basering; // remember the base ring 3307 execute("ring r@=("+ charstr(basering) +"),("+varstr(basering)+",homvar@), dp;");3307 ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+",homvar@)", "dp", "no_minpoly"); 3308 3308 execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings 3309 3309 ideal I=F(I); -
Singular/LIB/finvar.lib
rfa1cd3 r78eaa8 1390 1390 poly A(1)=M[1,2]; // denominator of Molien series (for now) 1391 1391 string mp=string(minpoly); 1392 execute("ring R=("+charstr(br)+"),("+varstr(br)+"),ds;");1392 ring R = create_ring(ringlist(br)[1], "("+varstr(br)+")", "ds", "no_minpoly"); 1393 1393 if (mp!="0") 1394 1394 { -
Singular/LIB/goettsche.lib
rfa1cd3 r78eaa8 81 81 def br@=basering; // remember the base ring 82 82 // add additional variables z@, t@ to the base ring 83 execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;");83 ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly"); 84 84 execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings 85 85 // compute the generating function by the Goettsche's formula up to degree n in t@ … … 144 144 def br@=basering; // remember the base ring 145 145 // add additional variables z@, t@ to the base ring 146 execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;");146 ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly"); 147 147 execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings 148 148 // compute the generating function by the Goettsche's formula up to degree n in t@ … … 208 208 def br@=basering; // remember the base ring 209 209 // add additional variables z@, t@ to the base ring 210 execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;");210 ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly"); 211 211 execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings 212 212 poly rez=1; … … 267 267 def br@=basering; // remember the base ring 268 268 // add additional variables z@, t@ to the base ring 269 execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;");269 ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly"); 270 270 execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings 271 271 // compute the generating function by the Nakajima-Yoshioka formula up to degree n in t@ … … 322 322 def br@=basering; // remember the base ring 323 323 // add additional variables z@, t@ to the base ring 324 execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;");324 ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly"); 325 325 execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings 326 326 // compute the generating function by the Nakajima-Yoshioka formula up to degree n in t@ … … 377 377 def br@=basering; // remember the base ring 378 378 // add additional variables z@, t@ to the base ring 379 execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;");379 ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly"); 380 380 execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings 381 381 poly rez=1; … … 434 434 def br@=basering; // remember the base ring 435 435 // add additional variables z@, t@ to the base ring 436 execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;");436 ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly"); 437 437 execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings 438 438 poly rez=1; … … 485 485 def br@=basering; // remember the base ring 486 486 // add additional variables z@, t@ to the base ring 487 execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;");487 ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly"); 488 488 execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings 489 489 poly rez=1; … … 536 536 def br@=basering; // remember the base ring 537 537 // add additional variables z@, t@ to the base ring 538 execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", z@, t@), dp;");538 ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly"); 539 539 execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings 540 540 poly rez=1; … … 594 594 def br@=basering; // remember the base ring 595 595 // add additional variable t@ to the base ring 596 execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", t@), dp;");596 ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", t@)", "dp", "no_minpoly"); 597 597 execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings 598 598 poly rez=(1-t@^2)*PPolyW(q, m, n, t@, d); … … 637 637 def br@=basering; // remember the base ring 638 638 // add additional variable t@ to the base ring 639 execute("ring r@= (" + charstr(basering) + "),("+varstr(basering)+", t@), dp;");639 ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", t@)", "dp", "no_minpoly"); 640 640 execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings 641 641 poly rez=(1-t@^2)*PPolyW(q, m, n, t@, d); -
Singular/LIB/graal.lib
rfa1cd3 r78eaa8 210 210 { 211 211 def origin = basering; 212 execute("ring ringForGeneralPosition = ("+charstr(basering)+"),("+varstr(basering)+"),lp;");212 ring ringForGeneralPosition = create_ring(ringlist(basering)[1], "("+varstr(basering)+")", "lp", "no_minpoly"); 213 213 ideal m = fetch(origin,m); 214 214 newRing = 1; -
Singular/LIB/numerAlg.lib
rfa1cd3 r78eaa8 230 230 setring W1; 231 231 number j1=jj; 232 execute("ring q=(real,0),("+varstr(S)+"),dp;");232 ring q = create_ring("(real,0)", "("+varstr(S)+")", "dp"); 233 233 ideal I=imap(W1,I); 234 234 ideal J=imap(W1,J); 235 execute("ring qq=0,("+varstr(S)+"),dp;");235 ring qq = create_ring(0, "("+varstr(S)+")", "dp"); 236 236 ideal I=imap(S,I); 237 237 ideal J=imap(S,J); … … 315 315 if((u^2)==0) 316 316 { 317 execute("ring A=(real,e-1),("+varstr(S)+",I),ds;");317 ring A = create_ring("(real,e-1)", "("+varstr(S)+",I)", "ds"); 318 318 ideal II=imap(S,J); 319 319 list rw=imap(S,rw); … … 332 332 { 333 333 int d=dim(std(J)); 334 execute("ring R=(complex,e-1,I),("+varstr(S)+"),ds;");334 ring R = create_ring("(complex,e-1,I)", "("+varstr(S)+")", "ds"); 335 335 list w=imap(S,w); 336 336 ideal II=imap(S,J); … … 355 355 if(tt==d) 356 356 { 357 execute("ring A=(complex,e,I),("+varstr(S)+"),dp;");357 ring A = create_ring("(complex,e,I)", "("+varstr(S)+")", "dp"); 358 358 t=tt; 359 359 } 360 360 else 361 361 { 362 execute("ring RR=(real,e-2),("+varstr(S)+",I),dp;");362 ring RR = create_ring("(real,e-2)", "("+varstr(S)+",I)", "dp"); 363 363 ideal II=imap(S,J); 364 364 list rw=imap(S,rw); … … 398 398 setring M; 399 399 sz1=size(SOL); 400 execute("ring RRRQ=(real,e-1),("+varstr(S)+",I),dp;");400 ring RRRQ = create_ring("(real,e-1)", "("+varstr(S)+",I)", "dp"); 401 401 ideal HH=imap(RR,HH); 402 402 if(dim(std(HH))==0) … … 413 413 if(sz1==sz2) 414 414 { 415 execute("ring A=(complex,e,I),("+varstr(S)+"),dp;");415 ring A = create_ring("(complex,e,I)", "("+varstr(S)+")", "dp"); 416 416 t=d; 417 417 } 418 418 else 419 419 { 420 execute("ring RQ=(real,e-1),("+varstr(S)+"),dp;");420 ring RQ = create_ring("(real,e-1)", "("+varstr(S)+")", "dp"); 421 421 ideal II=imap(S,J); 422 422 def RW=WitSet(II); … … 448 448 if((ni+nr)<1/10^(2*e-3)) 449 449 { 450 execute("ring A=(complex,e,I),("+varstr(S)+"),dp;");450 ring A = create_ring("(complex,e,I)", "("+varstr(S)+")", "dp"); 451 451 list W(ii)=imap(RW,W(ii)); 452 452 t=0; … … 459 459 { 460 460 def SS=Singular2bertini(W(ii)); 461 execute("ring D=(complex,e,I),("+varstr(S)+",s,gamma),dp;");461 ring D = create_ring("(complex,e,I)", "("+varstr(S)+",s,gamma)", "dp"); 462 462 string nonsin; 463 463 ideal H,L; … … 504 504 if(tr<=1/10^(2*e-3)) 505 505 { 506 execute("ring A=(complex,e,I),("+varstr(S)+"),dp;");506 ring A = create_ring("(complex,e,I)", "("+varstr(S)+")", "dp"); 507 507 t=ii; 508 508 ii=d+1; -
Singular/LIB/numerDecom.lib
rfa1cd3 r78eaa8 349 349 if((n-rn)!=dd) 350 350 { 351 execute("ring R=0,("+varstr(S)+",z(1..dd)),dp;"); 351 list l2 = ringlist(S)[2]; 352 for (int ii = 1; ii <= dd; ii++) 353 { 354 l2[size(l2)+1] = "z("+string(ii)+")"; 355 } 356 ring R = create_ring(0, l2, "dp"); 352 357 ideal I=imap(rs,I); 353 358 ideal H(0..n),L,LL,L(1..dd),LL(1..dd),h(1..dd),N(0..dd); … … 483 488 { 484 489 int w(q-1)=0; 485 execute("ring D(q)=(0,s,gamma),("+varstr(S)+",z(1..q)),dp;"); 490 list l2 = ringlist(S)[2]; 491 for (int ii = 1; ii <= q; ii++) 492 { 493 l2[size(l2)+1] = "z("+string(ii)+")"; 494 } 495 ring D(q) = create_ring("(0,s,gamma)", l2, "dp"); 486 496 string nonsin(q),stnonsin(q); 487 497 ideal H(1..q); … … 579 589 for(qq=q-1;qq>=1;qq--) 580 590 { 581 execute("ring T(qq)=(complex,16,I),("+varstr(S)+",z(1..qq)),dp;"); 591 list l2 = ringlist(S)[2]; 592 for (int ii = 1; ii <= qq; ii++) 593 { 594 l2[size(l2)+1] = "z("+string(ii)+")"; 595 } 596 ring T(qq) = create_ring("(complex,16,I)", l2, "dp"); 582 597 list W(qq-1)=var(1); 583 598 } … … 591 606 { 592 607 int w(qq-1); 593 execute("ring T(qq)=(complex,16,I),("+varstr(S)+",z(1..qq)),dp;"); 608 list l2 = ringlist(S)[2]; 609 for (int ii = 1; ii <= qq; ii++) 610 { 611 l2[size(l2)+1] = "z("+string(ii)+")"; 612 } 613 ring T(qq) = create_ring("(complex,16,I)", l2, "dp"); 594 614 list W(qq-1)=var(1); 595 615 } … … 600 620 for(qq=q;qq>=1;qq--) 601 621 { 602 execute("ring T(qq)=(complex,16,I),("+varstr(S)+",z(1..qq)),dp;"); 622 list l2 = ringlist(S)[2]; 623 for (int ii = 1; ii <= qq; ii++) 624 { 625 l2[size(l2)+1] = "z("+string(ii)+")"; 626 } 627 ring T(qq) = create_ring("(complex,16,I)", l2, "dp"); 603 628 list W(qq-1)=var(1); 604 629 } … … 1951 1976 export(J(i)); 1952 1977 } 1953 execute("ring RR=0,(x(1..n),"+varstr(S)+"),dp;"); 1978 list l2; 1979 for (int ii = 1; ii <= n; ii++) 1980 { 1981 l2[ii] = "x("+string(ii)+")"; 1982 } 1983 l2 = l2+ringlist(S)[2]; 1984 ring RR = create_ring(0, l2, "dp"); 1954 1985 for(i=1;i<=d;i++) 1955 1986 { … … 1995 2026 int zc=size(D(d)); 1996 2027 export(zc); 1997 execute("ring DR=0,("+varstr(S)+",x(1..zc)),dp;"); 2028 list l2 = ringlist(S)[2]; 2029 for (int ii = 1; ii <= zc; ii++) 2030 { 2031 l2[size(l2)+1] = "x("+string(ii)+")"; 2032 } 2033 ring DR = create_ring(0, l2, "dp"); 1998 2034 matrix TT(d)=imap(R,TT(d)); 1999 2035 ideal I=imap(S,I); -
Singular/LIB/resolve.lib
rfa1cd3 r78eaa8 396 396 laM=subst(laM,var(templist[4][j]),0); 397 397 } 398 execute("ring Rnew=("+charstr(basering)+"),("+string(templist[1])+"),dp;");398 ring Rnew = create_ring(ringlist(basering)[1], "("+string(templist[1])+")", "dp", "no_minpoly"); 399 399 ideal Jnew=imap(R,Jsub); 400 400 ideal eD=imap(R,Esub); … … 639 639 v=N[4]; 640 640 for(j=1;j<=size(v);j++){BO[5]=subst(BO[5],var(v[j]),0);} 641 execute("ring R1=("+charstr(R0)+"),("+newvar+"),dp;");641 ring R1 = create_ring(ringlist(R0)[1], "("+newvar+")", "dp", "no_minpoly"); 642 642 list BO=imap(R0,BO); 643 643 ideal C=imap(R0,C); … … 1115 1115 laM=subst(laM,var(v[j]),0); 1116 1116 } 1117 execute("ring R2=("+charstr(S)+"),("+newvar+"),dp;");1117 ring R2 = create_ring(ringlist(S)[1], "("+newvar+")", "dp", "no_minpoly"); 1118 1118 list BO=imap(S,B); 1119 1119 ideal laM=imap(S,laM); … … 2984 2984 //--- hypersurface is V(@f) 2985 2985 @f=Jb[fvec[i]]; 2986 execute("ring R1=("+charstr(R)+"),(@y,"+varstr(R)+"),dp;");2986 ring R1 = create_ring(ringlist(R)[1], "(@y,"+varstr(R)+")", "dp", "no_minpoly"); 2987 2987 poly p=imap(R,@p); 2988 2988 poly f=imap(R,@f); … … 4233 4233 kill tr,L; 4234 4234 } 4235 execute("ring R1=("+charstr(S)+"),(@z,"+varstr(S)+"),dp;");4235 ring R1 = create_ring(ringlist(S)[1], "(@z,"+varstr(S)+")", "dp", "no_minpoly"); 4236 4236 poly p=imap(S,@p); 4237 4237 list BO=imap(S,BO); … … 4800 4800 { 4801 4801 string newvar=string(N[1]); 4802 execute("ring R1=("+charstr(R)+"),("+newvar+"),dp;");4802 ring R1 = create_ring(ringlist(R)[1], "("+newvar+")", "dp", "no_minpoly"); 4803 4803 list BO=imap(R,BO); 4804 4804 ideal cent=imap(R,cent); -
Singular/LIB/rinvar.lib
rfa1cd3 r78eaa8 658 658 minPoly = string(minpoly); 659 659 } 660 execute("ring RA1=0,(" + varstr(basering) + "," + parName + "), lp;");660 ring RA1 = create_ring(0, "(" + varstr(basering) + "," + parName + ")", "lp"); 661 661 if (minPoly!="0") { execute("ideal mpoly = std(" + minPoly + ");"); } 662 662 ideal I = imap(RIRR,invarsGens); … … 962 962 minPoly = string(minpoly); 963 963 } 964 execute("ring RA1=0,(" + varstr(basering) + "," + parName + "), lp;");964 ring RA1 = create_ring(0, "(" + varstr(basering) + "," + parName + ")", "lp"); 965 965 if (minPoly!="0") { execute("ideal mpoly = std(" + minPoly + ");"); } 966 966 ideal Grp = imap(ROBR,Grp); -
Singular/LIB/sing.lib
rfa1cd3 r78eaa8 1076 1076 int ii; 1077 1077 def bas = basering; 1078 execute("ring @r_locstd 1079 =("+charstr(bas)+"),(@t@,"+varstr(bas)+"),(dp(1),dp);"); 1078 ring @r_locstd = create_ring(ringlist(bas)[1], "(@t@,"+varstr(bas)+")", "(dp(1),dp)", "no_minpoly"); 1080 1079 ideal @id = imap(bas,id); 1081 1080 ideal @hid = homog(@id,@t@); -
Singular/LIB/standard.lib
rfa1cd3 r78eaa8 2572 2572 { 2573 2573 string name; 2574 intvec w;2575 2574 int b1 = find(ordering, "(", 1); 2576 2575 if (b1 == 0) // no parentheses … … 2579 2578 if (name == "C" || name == "c") 2580 2579 { 2581 w = intvec(0);2580 intvec w = intvec(0); 2582 2581 } 2583 2582 else 2584 2583 { 2585 w = 1:n_vars;2584 intvec w = 1:n_vars; 2586 2585 } 2587 2586 } … … 2593 2592 if (c == 0) 2594 2593 { 2595 w = 1:int(ordering[b1+1, b2-b1-1]); 2594 if (name == "L") 2595 { 2596 int w = int(ordering[b1+1, b2-b1-1]); 2597 } 2598 else 2599 { 2600 intvec w = 1:int(ordering[b1+1, b2-b1-1]); 2601 } 2596 2602 } 2597 2603 else 2598 2604 { 2599 2605 list W = tuple_to_tokens(ordering[b1, b2-b1+1]); 2600 w = intvec(int(W[1..size(W)]));2606 intvec w = intvec(int(W[1..size(W)])); 2601 2607 } 2602 2608 } -
Singular/LIB/tropical.lib
rfa1cd3 r78eaa8 3644 3644 CHARAKTERISTIK=CHARAKTERISTIK[1..size(CHARAKTERISTIK)-2]; 3645 3645 def BASERING=basering; 3646 execute("ring INITIALRING=("+CHARAKTERISTIK+"),("+varstr(basering)+"),("+ordstr(basering)+");");3646 ring INITIALRING = create_ring("("+CHARAKTERISTIK+")", "("+varstr(basering)+")", "("+ordstr(basering)+")"); 3647 3647 list l=solve(imap(BASERING,i)); 3648 3648 l; … … 5551 5551 setring LIFTRing; 5552 5552 poly mp=minpoly; 5553 execute("ring TESTRing=("+charstr(LIFTRing)+"),("+varstr(BASERING)+"),dp;");5553 ring TESTRing = create_ring(ringlist(LIFTRing)[1], "("+varstr(BASERING)+")", "dp", "no_minpoly"); 5554 5554 minpoly=number(imap(LIFTRing,mp)); 5555 5555 ideal i=imap(BASERING,i); … … 5939 5939 else 5940 5940 { 5941 execute("ring PARARing=("+charstr(basering)+"),t,ls;");5941 ring PARARing = create_ring(ringlist(basering)[1], "t", "ls", "no_minpoly"); 5942 5942 } 5943 5943 ideal PARA; // will contain the parametrisation … … 6200 6200 else 6201 6201 { 6202 execute("ring SATURATERING=("+charstr(basering)+"),("+varstr(basering)+"),("+ordstr(basering)+");");6202 ring SATURATERING = create_ring(ringlist(basering)[1], "("+varstr(basering)+")", "("+ordstr(basering)+")", "no_minpoly"); 6203 6203 ideal i=imap(BASERING,i); 6204 6204 export(i); … … 6341 6341 // - the variable t is superflous, 6342 6342 // the variable @a is not if it was already present 6343 execute("ring INITIALRING=("+charstr(basering)+"),("+string(variablen)+"),dp;");6343 ring INITIALRING = create_ring(ringlist(basering)[1], "("+string(variablen)+")", "dp", "no_minpoly"); 6344 6344 ideal ini=imap(BASERING,ini); 6345 6345 // compute the minimal associated primes of the … … 6367 6367 // define the extension ring which contains 6368 6368 // the new variable @a, if it is not yet present 6369 execute("ring EXTENSIONRING=("+charstr(BASERING)+"),("+string(imap(BASERING,variablen))+",@a,"+tvar+"),(dp("+string(anzahlvariablen-1)+"),dp(1),lp(1));");6369 ring EXTENSIONRING = create_ring(ringlist(BASERING)[1], "("+string(imap(BASERING,variablen))+",@a,"+tvar+")", "(dp("+string(anzahlvariablen-1)+"),dp(1),lp(1))", "no_minpoly"); 6370 6370 // phi maps x_i to x_i, @a to @a (if present in the ring), 6371 6371 // and the additional variable … … 6378 6378 else // @a was already present in the BASERING or no 6379 6379 { // field extension is necessary 6380 execute("ring EXTENSIONRING=("+charstr(BASERING)+"),("+varstr(BASERING)+"),("+ordstr(BASERING)+");");6380 ring EXTENSIONRING = create_ring(ringlist(BASERING)[1], "("+varstr(BASERING)+")", "("+ordstr(BASERING)+")", "no_minpoly"); 6381 6381 // phi maps x_i to x_i, @a to @a (if present in the ring), 6382 6382 // and the additional variable … … 7255 7255 { 7256 7256 def BASERING=basering; 7257 execute("ring INTERRING=0,("+varstr(basering)+"),("+ordstr(basering)+");");7257 ring INTERRING = create_ring(0, "("+varstr(basering)+")", "("+ordstr(basering)+")"); 7258 7258 poly n=imap(BASERING,n); 7259 execute("ring REALRING=(real,50,100),("+varstr(basering)+"),("+ordstr(basering)+");");7259 ring REALRING = create_ring("(real,50,100)", "("+varstr(basering)+")", "("+ordstr(basering)+")"); 7260 7260 map phi=INTERRING,maxideal(1); 7261 7261 string s=string(phi(n)); … … 7873 7873 { 7874 7874 def BASERING=basering; 7875 execute("ring TRING="+string(char(BASERING))+",t,ds;");7875 ring TRING = create_ring(string(char(BASERING)), "t", "ds"); 7876 7876 poly hn=imap(BASERING,hn); 7877 7877 poly c4=imap(BASERING,c4); -
factory/FLINTconvert.cc
rcbb89a7 r78eaa8 24 24 #include "singext.h" 25 25 #include "cf_algorithm.h" 26 27 #ifdef HAVE_OMALLOC 28 #define Alloc(L) omAlloc(L) 29 #define Free(A,L) omFreeSize(A,L) 30 #else 31 #define Alloc(L) malloc(L) 32 #define Free(A,L) free(A) 33 #endif 26 34 27 35 #ifdef HAVE_FLINT … … 53 61 #include <flint/fq_nmod_mat.h> 54 62 #endif 63 #if ( __FLINT_RELEASE >= 20503) 64 #include <flint/fmpq_mpoly.h> 65 #endif 55 66 #ifdef __cplusplus 56 67 } … … 152 163 if (f.isImm ()) 153 164 { 154 fmpz_set_si (fmpq_numref (result), f. num().intval());155 fmpz_set_si (fmpq_denref (result), f.den().intval());156 } 157 else 165 fmpz_set_si (fmpq_numref (result), f.intval()); 166 fmpz_set_si (fmpq_denref (result), 1); 167 } 168 else if(f.inQ()) 158 169 { 159 170 mpz_t gmp_val; … … 165 176 mpz_clear (gmp_val); 166 177 } 178 else if(f.inZ()) 179 { 180 mpz_t gmp_val; 181 f.mpzval(gmp_val); 182 fmpz_set_mpz (fmpq_numref (result), gmp_val); 183 mpz_clear (gmp_val); 184 fmpz_set_si (fmpq_denref (result), 1); 185 } 186 else 187 { 188 printf("wrong type\n"); 189 } 167 190 } 168 191 … … 181 204 182 205 CanonicalForm result; 183 if (mpz_is_imm (nnum) && mpz_is_imm (nden)) 184 { 185 num= CanonicalForm (mpz_get_si(nnum)); 186 den= CanonicalForm (mpz_get_si(nden)); 187 mpz_clear (nnum); 188 mpz_clear (nden); 189 result= num/den; 190 if (!isRat) 191 Off (SW_RATIONAL); 192 return result; 206 if (mpz_is_imm (nden)) 207 { 208 if (mpz_is_imm(nnum)) 209 { 210 num= CanonicalForm (mpz_get_si(nnum)); 211 den= CanonicalForm (mpz_get_si(nden)); 212 mpz_clear (nnum); 213 mpz_clear (nden); 214 result= num/den; 215 } 216 else if (mpz_cmp_si(nden,1)==0) 217 { 218 result= make_cf(nnum); 219 mpz_clear (nden); 220 } 221 else 222 result= make_cf (nnum, nden, false); 193 223 } 194 224 else 195 225 { 196 226 result= make_cf (nnum, nden, false); 197 if (!isRat)198 Off (SW_RATIONAL);199 return result;200 }227 } 228 if (!isRat) 229 Off (SW_RATIONAL); 230 return result; 201 231 } 202 232 … … 528 558 } 529 559 #endif 530 531 #endif 532 533 560 #if __FLINT_RELEASE >= 20503 561 static void convFlint_RecPP ( const CanonicalForm & f, ulong * exp, nmod_mpoly_t result, nmod_mpoly_ctx_t ctx, int N ) 562 { 563 // assume f!=0 564 if ( ! f.inCoeffDomain() ) 565 { 566 int l = f.level(); 567 for ( CFIterator i = f; i.hasTerms(); i++ ) 568 { 569 exp[N-l] = i.exp(); 570 convFlint_RecPP( i.coeff(), exp, result, ctx, N ); 571 } 572 exp[N-l] = 0; 573 } 574 else 575 { 576 int c=f.intval(); 577 if (c<0) c+=getCharacteristic(); 578 nmod_mpoly_push_term_ui_ui(result,c,exp,ctx); 579 } 580 } 581 582 static void convFlint_RecPP ( const CanonicalForm & f, ulong * exp, fmpq_mpoly_t result, fmpq_mpoly_ctx_t ctx, int N ) 583 { 584 // assume f!=0 585 if ( ! f.inBaseDomain() ) 586 { 587 int l = f.level(); 588 for ( CFIterator i = f; i.hasTerms(); i++ ) 589 { 590 exp[N-l] = i.exp(); 591 convFlint_RecPP( i.coeff(), exp, result, ctx, N ); 592 } 593 exp[N-l] = 0; 594 } 595 else 596 { 597 fmpq_t c; 598 fmpq_init(c); 599 convertCF2Fmpq(c,f); 600 fmpq_mpoly_push_term_fmpq_ui(result,c,exp,ctx); 601 fmpq_clear(c); 602 } 603 } 604 605 void convFactoryPFlintMP ( const CanonicalForm & f, nmod_mpoly_t res, nmod_mpoly_ctx_t ctx, int N ) 606 { 607 if (f.isZero()) return; 608 ulong * exp = (ulong*)Alloc(N*sizeof(ulong)); 609 memset(exp,0,N*sizeof(ulong)); 610 convFlint_RecPP( f, exp, res, ctx, N ); 611 Free(exp,N*sizeof(ulong)); 612 } 613 614 void convFactoryPFlintMP ( const CanonicalForm & f, fmpq_mpoly_t res, fmpq_mpoly_ctx_t ctx, int N ) 615 { 616 if (f.isZero()) return; 617 ulong * exp = (ulong*)Alloc(N*sizeof(ulong)); 618 memset(exp,0,N*sizeof(ulong)); 619 convFlint_RecPP( f, exp, res, ctx, N ); 620 fmpq_mpoly_reduce(res,ctx); 621 Free(exp,N*sizeof(ulong)); 622 } 623 624 CanonicalForm convFlintMPFactoryP(nmod_mpoly_t f, nmod_mpoly_ctx_t ctx, int N) 625 { 626 CanonicalForm result; 627 int d=nmod_mpoly_length(f,ctx)-1; 628 ulong* exp=(ulong*)Alloc(N*sizeof(ulong)); 629 for(int i=d; i>=0; i--) 630 { 631 ulong c=nmod_mpoly_get_term_coeff_ui(f,i,ctx); 632 nmod_mpoly_get_term_exp_ui(exp,f,i,ctx); 633 CanonicalForm term=(int)c; 634 for ( int i = 0; i <N; i++ ) 635 { 636 if (exp[i]!=0) term*=CanonicalForm( Variable( N-i ), exp[i] ); 637 } 638 result+=term; 639 } 640 Free(exp,N*sizeof(ulong)); 641 return result; 642 } 643 644 CanonicalForm convFlintMPFactoryP(fmpq_mpoly_t f, fmpq_mpoly_ctx_t ctx, int N) 645 { 646 CanonicalForm result; 647 int d=fmpq_mpoly_length(f,ctx)-1; 648 ulong* exp=(ulong*)Alloc(N*sizeof(ulong)); 649 fmpq_t c; 650 fmpq_init(c); 651 for(int i=d; i>=0; i--) 652 { 653 fmpq_mpoly_get_term_coeff_fmpq(c,f,i,ctx); 654 fmpq_mpoly_get_term_exp_ui(exp,f,i,ctx); 655 CanonicalForm term=convertFmpq_t2CF(c); 656 for ( int i = 0; i <N; i++ ) 657 { 658 if (exp[i]!=0) term*=CanonicalForm( Variable( N-i ), exp[i] ); 659 } 660 result+=term; 661 } 662 fmpq_clear(c); 663 Free(exp,N*sizeof(ulong)); 664 return result; 665 } 666 667 // stolen from: 668 // https://graphics.stanford.edu/~seander/bithacks.html#IntegerLog 669 static inline int SI_LOG2(int v) 670 { 671 const unsigned int b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000}; 672 const unsigned int S[] = {1, 2, 4, 8, 16}; 673 674 unsigned int r = 0; // result of log2(v) will go here 675 if (v & b[4]) { v >>= S[4]; r |= S[4]; } 676 if (v & b[3]) { v >>= S[3]; r |= S[3]; } 677 if (v & b[2]) { v >>= S[2]; r |= S[2]; } 678 if (v & b[1]) { v >>= S[1]; r |= S[1]; } 679 if (v & b[0]) { v >>= S[0]; r |= S[0]; } 680 return (int)r; 681 } 682 683 CanonicalForm mulFlintMP_Zp(const CanonicalForm& F,int lF, const CanonicalForm& G, int lG,int m) 684 { 685 int bits=SI_LOG2(m)+1; 686 int N=F.level(); 687 nmod_mpoly_ctx_t ctx; 688 nmod_mpoly_ctx_init(ctx,N,ORD_LEX,getCharacteristic()); 689 nmod_mpoly_t f,g,res; 690 nmod_mpoly_init3(f,lF,bits,ctx); 691 nmod_mpoly_init3(g,lG,bits,ctx); 692 convFactoryPFlintMP(F,f,ctx,N); 693 convFactoryPFlintMP(G,g,ctx,N); 694 nmod_mpoly_init3(res,lF+lG,bits+1,ctx); 695 nmod_mpoly_mul(res,f,g,ctx); 696 nmod_mpoly_clear(g,ctx); 697 nmod_mpoly_clear(f,ctx); 698 CanonicalForm RES=convFlintMPFactoryP(res,ctx,N); 699 nmod_mpoly_clear(res,ctx); 700 nmod_mpoly_ctx_clear(ctx); 701 return RES; 702 } 703 704 CanonicalForm mulFlintMP_QQ(const CanonicalForm& F,int lF, const CanonicalForm& G, int lG, int m) 705 { 706 int bits=SI_LOG2(m)+1; 707 int N=F.level(); 708 fmpq_mpoly_ctx_t ctx; 709 fmpq_mpoly_ctx_init(ctx,N,ORD_LEX); 710 fmpq_mpoly_t f,g,res; 711 fmpq_mpoly_init3(f,lF,bits,ctx); 712 fmpq_mpoly_init3(g,lG,bits,ctx); 713 convFactoryPFlintMP(F,f,ctx,N); 714 convFactoryPFlintMP(G,g,ctx,N); 715 fmpq_mpoly_init3(res,lF+lG,bits+1,ctx); 716 fmpq_mpoly_mul(res,f,g,ctx); 717 fmpq_mpoly_clear(g,ctx); 718 fmpq_mpoly_clear(f,ctx); 719 CanonicalForm RES=convFlintMPFactoryP(res,ctx,N); 720 fmpq_mpoly_clear(res,ctx); 721 fmpq_mpoly_ctx_clear(ctx); 722 return RES; 723 } 724 725 CanonicalForm gcdFlintMP_Zp(const CanonicalForm& F, const CanonicalForm& G) 726 { 727 int N=F.level(); 728 int lf,lg,m=1<<MPOLY_MIN_BITS; 729 lf=size_maxexp(F,m); 730 lg=size_maxexp(G,m); 731 int bits=SI_LOG2(m)+1; 732 nmod_mpoly_ctx_t ctx; 733 nmod_mpoly_ctx_init(ctx,N,ORD_LEX,getCharacteristic()); 734 nmod_mpoly_t f,g,res; 735 nmod_mpoly_init3(f,lf,bits,ctx); 736 nmod_mpoly_init3(g,lg,bits,ctx); 737 convFactoryPFlintMP(F,f,ctx,N); 738 convFactoryPFlintMP(G,g,ctx,N); 739 nmod_mpoly_init3(res,lf,bits,ctx); 740 int ok=nmod_mpoly_gcd(res,f,g,ctx); 741 nmod_mpoly_clear(g,ctx); 742 nmod_mpoly_clear(f,ctx); 743 CanonicalForm RES=1; 744 if (ok) 745 { 746 RES=convFlintMPFactoryP(res,ctx,N); 747 } 748 nmod_mpoly_clear(res,ctx); 749 nmod_mpoly_ctx_clear(ctx); 750 return RES; 751 } 752 753 CanonicalForm gcdFlintMP_QQ(const CanonicalForm& F, const CanonicalForm& G) 754 { 755 int N=F.level(); 756 fmpq_mpoly_ctx_t ctx; 757 fmpq_mpoly_ctx_init(ctx,N,ORD_LEX); 758 fmpq_mpoly_t f,g,res; 759 fmpq_mpoly_init(f,ctx); 760 fmpq_mpoly_init(g,ctx); 761 convFactoryPFlintMP(F,f,ctx,N); 762 convFactoryPFlintMP(G,g,ctx,N); 763 fmpq_mpoly_init(res,ctx); 764 int ok=fmpq_mpoly_gcd(res,f,g,ctx); 765 fmpq_mpoly_clear(g,ctx); 766 fmpq_mpoly_clear(f,ctx); 767 CanonicalForm RES=1; 768 if (ok) 769 { 770 // Flint normalizes the gcd to be monic. 771 // Singular wants a gcd defined over ZZ that is primitive and has a positive leading coeff. 772 if (!fmpq_mpoly_is_zero(res, ctx)) 773 { 774 fmpq_t content; 775 fmpq_init(content); 776 fmpq_mpoly_content(content, res, ctx); 777 fmpq_mpoly_scalar_div_fmpq(res, res, content, ctx); 778 fmpq_clear(content); 779 } 780 RES=convFlintMPFactoryP(res,ctx,N); 781 } 782 fmpq_mpoly_clear(res,ctx); 783 fmpq_mpoly_ctx_clear(ctx); 784 return RES; 785 } 786 787 #endif 788 789 #endif 790 791 -
factory/FLINTconvert.h
rcbb89a7 r78eaa8 250 250 251 251 252 #endif 253 #endif 252 #if __FLINT_RELEASE >= 20503 253 CanonicalForm mulFlintMP_Zp(const CanonicalForm& F,int lF, const CanonicalForm& Gi, int lG, int m); 254 CanonicalForm mulFlintMP_QQ(const CanonicalForm& F,int lF, const CanonicalForm& Gi, int lG, int m); 255 CanonicalForm gcdFlintMP_Zp(const CanonicalForm& F, const CanonicalForm& G); 256 CanonicalForm gcdFlintMP_QQ(const CanonicalForm& F, const CanonicalForm& G); 257 #endif 258 #endif 259 #endif -
factory/NTLconvert.cc
rcbb89a7 r78eaa8 33 33 #include "NTLconvert.h" 34 34 35 #ifdef HAVE_OMALLOC 36 #define Alloc(L) omAlloc(L) 37 #define Free(A,L) omFreeSize(A,L) 38 #else 35 39 #define Alloc(L) malloc(L) 36 40 #define Free(A,L) free(A) 41 #endif 37 42 38 43 void out_cf(const char *s1,const CanonicalForm &f,const char *s2); -
factory/canonicalform.cc
rcbb89a7 r78eaa8 17 17 #include "gfops.h" 18 18 #include "facMul.h" 19 #include "facAlgFuncUtil.h" 19 20 #include "FLINTconvert.h" 20 21 … … 707 708 else if ( value->level() == cf.value->level() ) { 708 709 #if (HAVE_NTL && HAVE_FLINT && __FLINT_RELEASE >= 20400) 710 #if (__FLINT_RELEASE >= 20503) 711 int l_this,l_cf,m=1; 712 if ((getCharacteristic()>0) 713 && (CFFactory::gettype() != GaloisFieldDomain) 714 &&(!hasAlgVar(*this)) 715 &&(!hasAlgVar(cf)) 716 &&((l_cf=size_maxexp(cf,m))>10) 717 &&((l_this=size_maxexp(*this,m))>10) 718 ) 719 { 720 *this=mulFlintMP_Zp(*this,l_this,cf,l_cf,m); 721 } 722 else 723 /*-----------------------------------------------------*/ 724 if ((getCharacteristic()==0) 725 &&(!hasAlgVar(*this)) 726 &&(!hasAlgVar(cf)) 727 &&((l_cf=size_maxexp(cf,m))>10) 728 &&((l_this=size_maxexp(*this,m))>10) 729 ) 730 { 731 *this=mulFlintMP_QQ(*this,l_this,cf,l_cf,m); 732 } 733 else 734 #endif 735 709 736 if (value->levelcoeff() == cf.value->levelcoeff() && cf.isUnivariate() && (*this).isUnivariate()) 710 737 { -
factory/cf_gcd.cc
rcbb89a7 r78eaa8 26 26 #include "cfSubResGcd.h" 27 27 #include "cfModGcd.h" 28 #include "FLINTconvert.h" 28 29 #include "facAlgFuncUtil.h" 29 30 … … 100 101 if ( getCharacteristic() != 0 ) 101 102 { 103 #if defined(HAVE_FLINT) && ( __FLINT_RELEASE >= 20503) 104 if ( isOn( SW_USE_FL_GCD_P) 105 && (CFFactory::gettype() != GaloisFieldDomain) 106 && (getCharacteristic()>500) 107 &&(!hasAlgVar(fc)) && (!hasAlgVar(gc))) 108 { 109 return gcdFlintMP_Zp(fc,gc); 110 } 111 #endif 102 112 #ifdef HAVE_NTL 103 113 if ((!fc_and_gc_Univariate) && (isOn( SW_USE_EZGCD_P ))) … … 119 129 fc = subResGCD_p( fc, gc ); 120 130 } 121 else if (!fc_and_gc_Univariate) 131 else if (!fc_and_gc_Univariate) /* && char==0*/ 122 132 { 133 #if defined(HAVE_FLINT) && ( __FLINT_RELEASE >= 20503) 134 if (( isOn( SW_USE_FL_GCD_0) ) 135 &&(!hasAlgVar(fc)) && (!hasAlgVar(gc))) 136 { 137 return gcdFlintMP_QQ(fc,gc); 138 } 139 else 140 #endif 123 141 if ( isOn( SW_USE_EZGCD ) ) 124 142 fc= ezgcd (fc, gc); 125 #ifdef HAVE_NTL143 #ifdef HAVE_NTL 126 144 else if (isOn(SW_USE_CHINREM_GCD)) 127 145 fc = modGCDZ( fc, gc); 128 #endif146 #endif 129 147 else 130 148 {
Note: See TracChangeset
for help on using the changeset viewer.