Changeset 8bdcfe in git
- Timestamp:
- Mar 16, 2007, 2:27:19 PM (17 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- d7ec93557f184076889ab9000aba4beb6874988b
- Parents:
- d1b99911a64bbf04d1c52b7382f40a4c2061e39c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/standard.lib
rd1b999 r8bdcfe 3 3 //groebner mit Optionen versehen 4 4 ////////////////////////////////////////////////////////////////////////////// 5 version="$Id: standard.lib,v 1. 89 2007-03-14 18:17:34Singular Exp $";5 version="$Id: standard.lib,v 1.90 2007-03-16 13:27:19 Singular Exp $"; 6 6 category="Miscellaneous"; 7 7 info=" … … 40 40 EXAMPLE: example stdfglm; shows an example" 41 41 { 42 if (nrows(i) > 1) 43 { 44 ERROR("first argument of 'stdfglm' must be an ideal"); 45 } 46 string os; 47 int s = size(#); 48 def P= basering; 49 string algorithm; 50 int ii; 51 for( ii=1; ii<=s; ii++) 52 { 53 if ( typeof(#[ii])== "string" ) 42 if (nrows(i) > 1) 43 { 44 ERROR("first argument of 'stdfglm' must be an ideal"); 45 } 46 string os; 47 int s = size(#); 48 def P= basering; 49 string algorithm; 50 int ii; 51 for( ii=1; ii<=s; ii++) 52 { 53 if ( typeof(#[ii])== "string" ) 54 { 55 if ( #[ii]=="std" || #[ii]=="slimgb" ) 54 56 { 55 if ( #[ii]=="std" || #[ii]=="slimgb" ) 56 { 57 algorithm = #[ii]; 58 # = delete(#,ii); 59 s = s-1; 60 ii--; 61 } 57 algorithm = #[ii]; 58 # = delete(#,ii); 59 s--; 60 ii--; 62 61 } 63 } 64 65 if( s > 0 && (typeof(#[1]) == "string") ) 66 { 67 os = #[1]; 68 ideal Qideal = ideal(P); 69 int sQ = size(Qideal); 70 int sM = size(minpoly); 71 if ( sM!=0 ) 62 } 63 } 64 65 if( s > 0 && (typeof(#[1]) == "string") ) 66 { 67 os = #[1]; 68 ideal Qideal = ideal(P); 69 int sQ = size(Qideal); 70 int sM = size(minpoly); 71 if ( sM!=0 ) 72 { 73 string mpoly = string(minpoly); 74 } 75 if (sQ!=0 ) 76 { 77 execute("ring Rfglm=("+charstr(P)+"),("+varstr(P)+"),"+os+";"); 78 ideal Qideal = fetch(P,Qideal); 79 qring Pfglm = groebner(Qideal,"std","slimgb"); 80 } 81 else 82 { 83 execute("ring Pfglm=("+charstr(P)+"),("+varstr(P)+"),"+os+";"); 84 } 85 if ( sM!=0 ) 86 { 87 execute("minpoly="+mpoly+";"); 88 } 89 } 90 else 91 { 92 list BRlist = ringlist(P); 93 int nvarP = nvars(P); 94 intvec w; //for ringweights of basering P 95 int k; 96 for(k=1; k <= nvarP; k++) 97 { 98 w[k]=deg(var(k)); 99 } 100 101 BRlist[3] = list(); 102 if( s==0 or (typeof(#[1]) != "string") ) 103 { 104 if( w==1 ) 72 105 { 73 string mpoly = string(minpoly); 74 } 75 if (sQ!=0 ) 76 { 77 execute("ring Rfglm=("+charstr(P)+"),("+varstr(P)+"),"+os+";"); 78 ideal Qideal = fetch(P,Qideal); 79 qring Pfglm = groebner(Qideal,"std","slimgb"); 106 BRlist[3][1]=list("dp",w); 80 107 } 81 108 else 82 109 { 83 execute("ring Pfglm=("+charstr(P)+"),("+varstr(P)+"),"+os+";");110 BRlist[3][1]=list("wp",w); 84 111 } 85 if ( sM!=0 ) 86 { 87 execute("minpoly="+mpoly+";"); 88 } 89 } 90 else 91 { 92 list BRlist = ringlist(P); 93 int nvarP = nvars(P); 94 intvec w; //for ringweights of basering P 95 int k; 96 for(k=1; k <= nvarP; k++) 97 { 98 w[k]=deg(var(k)); 99 } 100 101 BRlist[3] = list(); 102 if( s==0 or (typeof(#[1]) != "string") ) 103 { 104 if( w==1 ) 105 { 106 BRlist[3][1]=list("dp",w); 107 } 108 else 109 { 110 BRlist[3][1]=list("wp",w); 111 } 112 BRlist[3][2]=list("C",intvec(0)); 113 def Pfglm = ring(quotientList(BRlist)); 114 setring Pfglm; 115 } 116 } 117 ideal i = fetch(P,i); 118 119 intvec opt = option(get); //save options 120 option(redSB); 121 if (size(algorithm) > 0) 122 { 123 i = groebner(i,algorithm); 124 } 125 else 126 { 127 i = groebner(i); 128 } 129 option(set,opt); 130 setring P; 131 return (fglm(Pfglm,i)); 112 BRlist[3][2]=list("C",intvec(0)); 113 def Pfglm = ring(quotientList(BRlist)); 114 setring Pfglm; 115 } 116 } 117 ideal i = fetch(P,i); 118 119 intvec opt = option(get); //save options 120 option(redSB); 121 if (size(algorithm) > 0) 122 { 123 i = groebner(i,algorithm); 124 } 125 else 126 { 127 i = groebner(i); 128 } 129 option(set,opt); 130 setring P; 131 return (fglm(Pfglm,i)); 132 132 } 133 133 example … … 182 182 ideal Qideal = ideal(P); //defining the quotient ideal if P is a qring 183 183 int was_qring; //remembers if basering was a qring 184 int is_homog = homog(Qideal); //remembers if Qideal was homog (homog(0)=1) 185 is_homog = is_homog*homog(i); //check for homogeneity of i and Qideal 184 int is_homog =homog(i); //check for homogeneity of i and Qideal 186 185 if (size(Qideal) > 0) 187 186 { … … 197 196 for(k=1; k<=nvarP; k++) 198 197 { 199 198 w[k]=deg(var(k)); 200 199 } 201 200 int neg=1-attrib (P,"global"); … … 210 209 for (k=1; k<=size(#); k++) 211 210 { 212 213 214 215 216 217 218 219 211 if (typeof(#[k]) == "intvec") 212 { 213 intvec hi = #[k]; 214 } 215 if (typeof(#[k]) == "string") 216 { 217 method = method + "," + #[k]; 218 } 220 219 } 221 220 … … 224 223 for( k=ncols(i); k>0; k-- ) 225 224 { 226 225 i[k]=cleardenom(i[k]); 227 226 } 228 227 } … … 231 230 //Note that quotient ideal of qring must be homogeneous too 232 231 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 232 if( find(ordstr_P,"s") || find(ordstr_P,"M") 233 || find(ordstr_P,"a") || (neg > 0) ) 234 { 235 if( defined(hi) && is_homog ) 236 { 237 if (p_opt){"std with given Hilbert function in basering";} 238 return( std(i,hi,w) ); 239 } 240 if (p_opt){"//--stdhilb not implemented, use std in basering";} 241 //if ( neg ) 242 //{ 243 // "//*** WARNING: non-positive ring weights, computation may not finish"; 244 //} 245 return( std(i) ); 246 } 248 247 249 248 //------------------------ change to hilbRing ---------------------------- 250 249 251 252 253 254 255 250 list hiRi = hilbRing(i); //The ground field of P and Philb coincide 251 intvec W = hiRi[2]; //Philb has an extra variable @ or @(k) 252 def Philb = hiRi[1]; //Philb is no qring and the predefined 253 setring Philb; //ideal/module Id(1) in Philb is homogeneous 254 //Parameters of P are not converted in Philb 256 255 //-------- compute Hilbert function of homogenized ideal in Philb --------- 257 256 //Philb has only 1 block. There are three cases 258 257 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 258 string algorithm; //possibilities: std, slimgb, stdorslimgb 259 //define algorithm: 260 if( find(method,"std") && !find(method,"slimgb") ) 261 { 262 algorithm = "std"; 263 } 264 if( find(method,"slimgb") && !find(method,"std") ) 265 { 266 algorithm = "slimgb"; 267 } 268 if( find(method,"std") && find(method,"slimgb") || 269 (!find(method,"std") && !find(method,"slimgb")) ) 270 { 271 algorithm = "stdorslimgb"; 272 } 273 274 if ( algorithm=="std" || ( algorithm=="stdorslimgb" && char(P)>0 ) ) 275 { 276 if (p_opt) {"std in ring " + string(Philb);} 277 intvec hi = hilb( std(Id(1)),1,W ); 278 } 279 if ( algorithm=="slimgb" || ( algorithm=="stdorslimgb" && char(P)==0 ) ) 280 { 281 intvec hi = hilb(qslimgb(Id(1)),1,W); 282 } 283 284 //-------------- we need another intermediate ring Phelp ---------------- 285 //In Phelp we change the ordering from Philb, otherwise it coincides with 286 //Philb, that is, it has in addition to P an extra homogenizing variable 287 //with name @, resp. @(i) if @ and @(1), ..., @(i-1) are defined. 288 //Phelp has the same ordering as P on common variables. In Phelp 289 //a quotient ideal from P is added to the input 290 291 list BRlist = ringlist(Philb); 292 BRlist[3] = list(); 293 int so = size(ord_P); 294 if( ord_P[so][1] =="c" || ord_P[so][1] =="C" ) 295 { 296 list moduleord = ord_P[so]; 297 so = so-1; 298 } 299 for (k=1; k<=so; k++) 300 { 301 BRlist[3][k] = ord_P[k]; 302 } 303 304 BRlist[3][so+1] = list("dp",1); 305 w = w,1; 306 307 if( defined(moduleord) ) 308 { 309 BRlist[3][so+2] = moduleord; 310 } 312 311 313 312 //------ change to extended ring and compute std with hilbert series ------ 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 313 def Phelp = ring(quotientList(BRlist)); 314 setring Phelp; 315 def i = imap(Philb, Id(1)); 316 kill Philb; 317 318 // compute std with Hilbert series 319 if (w ==1) 320 { 321 if (p_opt){ "std with hilb in " + string(Phelp);} 322 i = std(i, hi); 323 } 324 else 325 { 326 if(p_opt){"std with weighted hilb in "+string(Phelp);} 327 i = std(i, hi, w); 328 } 330 329 331 330 //-------------------- go back to original ring --------------------------- 332 //The main computation is done. Do not forget to simplfy before maping. 333 334 // subst 1 for homogenizing var 335 if ( p_opt ) 336 { 337 "dehomogenization"; 338 } 339 i = subst(i, var(nvars(basering)), 1); 340 341 if (p_opt) 342 { 343 "simplification"; 344 } 345 i= simplify(i,34); 346 347 setring P; 348 if (p_opt) 349 { 350 "imap to ring "+string(P); 351 } 352 i = imap(Phelp,i); 353 kill Phelp; 354 if( was_qring) 355 { 356 i = NF(i,std(0)); 357 } 358 i = simplify(i,34); 359 360 // compute reduced SB 361 if (find(s_opt, "redSB") > 0) 362 { 363 if (p_opt) 364 { 365 "//interreduction"; 366 } 367 i=interred(i); 368 } 369 attrib(i, "isSB", 1); 370 return (i); 331 //The main computation is done. Do not forget to simplfy before maping. 332 333 // subst 1 for homogenizing var 334 if ( p_opt ) { "dehomogenization"; } 335 i = subst(i, var(nvars(basering)), 1); 336 337 if (p_opt) { "simplification"; } 338 i= simplify(i,34); 339 340 setring P; 341 if (p_opt) { "imap to ring "+string(P); } 342 i = imap(Phelp,i); 343 kill Phelp; 344 if( was_qring) 345 { 346 i = NF(i,std(0)); 347 } 348 i = simplify(i,34); 349 350 // compute reduced SB 351 if (find(s_opt, "redSB") > 0) 352 { 353 if (p_opt) { "//interreduction"; } 354 i=interred(i); 355 } 356 attrib(i, "isSB", 1); 357 return (i); 371 358 } 372 359 example … … 405 392 EXAMPLE: example quotientList; shows an example" 406 393 { 407 408 409 410 411 412 413 414 415 394 def P = basering; 395 if( size(#) > 0 ) 396 { 397 if ( #[1] == "isSB") 398 { 399 return (RL); 400 } 401 } 402 ideal Qideal = RL[4]; //##Achtung: falls basering Nullteiler hat, kann 416 403 //die SB eines Elements mehrere Elemente enthalten 417 418 419 420 421 422 423 424 425 426 427 428 404 if( size(Qideal) <= 0) 405 { 406 return (RL); 407 } 408 409 RL[4] = ideal(0); 410 def Phelp = ring(RL); 411 setring Phelp; 412 ideal Qideal = groebner(fetch(P,Qideal)); 413 setring P; 414 RL[4]=fetch(Phelp,Qideal); 415 return (RL); 429 416 } 430 417 example … … 459 446 EXAMPLE: example par2varRing; shows an example" 460 447 { 461 def P = basering; 462 int npar = npars(P); //number of parameters 463 int s = size(#); 464 int ii; 465 if ( npar == 0) 466 { 467 dbprint(printlevel-voice+3,"// ** no parameters, ring was not changed"); 468 for( ii = 1; ii <= s; ii++) 469 { 470 def Id(ii) = #[ii]; 471 export (Id(ii)); 472 } 473 return(list(P)); 474 } 475 476 list rlist = ringlist(P); 477 list parlist = rlist[1]; 478 rlist[1] = parlist[1]; 479 poly Minpoly = minpoly; //check for minpoly: 480 int sm = size(Minpoly); 481 482 //now create new ring 483 for( ii = 1; ii <= s; ii++) 484 { 448 def P = basering; 449 int npar = npars(P); //number of parameters 450 int s = size(#); 451 int ii; 452 if ( npar == 0) 453 { 454 dbprint(printlevel-voice+3,"// ** no parameters, ring was not changed"); 455 for( ii = 1; ii <= s; ii++) 456 { 485 457 def Id(ii) = #[ii]; 486 } 487 int nvar = size(rlist[2]); 488 int nblock = size(rlist[3]); 489 int k; 490 for (k=1; k<=npar; k++) 491 { 492 rlist[2][nvar+k] = parlist[2][k]; //change variable list 493 } 494 495 //converted parameters get one block dp. If module ordering was in front 496 //it stays in front, otherwise it will be moved to the end 497 intvec OW = 1:npar; 498 if( rlist[3][nblock][1] =="c" || rlist[3][nblock][1] =="C" ) 499 { 500 rlist[3][nblock+1] = rlist[3][nblock]; 501 rlist[3][nblock] = list("dp",OW); 502 } 503 else 504 { 505 rlist[3][nblock+1] = list("dp",OW); 506 } 507 508 def Ppar2var = ring(quotientList(rlist)); 509 setring Ppar2var; 510 if ( sm == 0 ) 511 { 512 for( ii = 1; ii <= s; ii++) 513 { 514 def Id(ii) = imap(P,Id(ii)); 515 export (Id(ii)); 516 } 517 } 518 else 519 { 520 if( find(option(),"prot") ){"//add minpoly to input";} 521 poly Minpoly = imap(P,Minpoly); 522 for( ii = 1; ii <= s; ii++) 523 { 524 def Id(ii) = imap(P,Id(ii)); 525 Id(ii) = Id(ii),Minpoly*freemodule(nrows(Id(ii))); 526 export (Id(ii)); 527 } 528 } 529 list Lpar2var = Ppar2var; 530 return(Lpar2var); 458 export (Id(ii)); 459 } 460 return(list(P)); 461 } 462 463 list rlist = ringlist(P); 464 list parlist = rlist[1]; 465 rlist[1] = parlist[1]; 466 poly Minpoly = minpoly; //check for minpoly: 467 int sm = size(Minpoly); 468 469 //now create new ring 470 for( ii = 1; ii <= s; ii++) 471 { 472 def Id(ii) = #[ii]; 473 } 474 int nvar = size(rlist[2]); 475 int nblock = size(rlist[3]); 476 int k; 477 for (k=1; k<=npar; k++) 478 { 479 rlist[2][nvar+k] = parlist[2][k]; //change variable list 480 } 481 482 //converted parameters get one block dp. If module ordering was in front 483 //it stays in front, otherwise it will be moved to the end 484 intvec OW = 1:npar; 485 if( rlist[3][nblock][1] =="c" || rlist[3][nblock][1] =="C" ) 486 { 487 rlist[3][nblock+1] = rlist[3][nblock]; 488 rlist[3][nblock] = list("dp",OW); 489 } 490 else 491 { 492 rlist[3][nblock+1] = list("dp",OW); 493 } 494 495 def Ppar2var = ring(quotientList(rlist)); 496 setring Ppar2var; 497 if ( sm == 0 ) 498 { 499 for( ii = 1; ii <= s; ii++) 500 { 501 def Id(ii) = imap(P,Id(ii)); 502 export (Id(ii)); 503 } 504 } 505 else 506 { 507 if( find(option(),"prot") ){"//add minpoly to input";} 508 poly Minpoly = imap(P,Minpoly); 509 for( ii = 1; ii <= s; ii++) 510 { 511 def Id(ii) = imap(P,Id(ii)); 512 Id(ii) = Id(ii),Minpoly*freemodule(nrows(Id(ii))); 513 export (Id(ii)); 514 } 515 } 516 list Lpar2var = Ppar2var; 517 return(Lpar2var); 531 518 } 532 519 example … … 566 553 " 567 554 { 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 if(w==1)617 {618 BRlist[3][1]=list("dp",w);619 }620 else621 {622 BRlist[3][1]=list("wp",w);623 }624 BRlist[3][2]=list("C",intvec(0));625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 555 def P = basering; 556 ideal Qideal = ideal(P); //defining the quotient ideal if P is a qring 557 if( size(Qideal) != 0 ) 558 { 559 int is_qring =1; 560 } 561 list BRlist = ringlist(P); 562 BRlist[4] = ideal(0); 563 564 int nvarP = nvars(P); 565 int s = size(#); 566 intvec w; //for ringweights of basering P 567 int k; 568 for(k=1; k<=nvarP; k++) 569 { 570 w[k]=deg(var(k)); 571 } 572 573 for(k = 1; k <= s; k++) 574 { 575 def Id(k) = #[k]; 576 int nr(k) = nrows(Id(k)); 577 } 578 579 // a homogenizing variable is added: 580 // call it @, resp. @(k) if @(1),...,@(k-1) are defined 581 string homvar; 582 if ( defined(@)==0 ) 583 { 584 homvar = "@"; 585 } 586 else 587 { 588 k=1; 589 while( defined(@(k)) != 0 ) 590 { 591 k++; 592 } 593 homvar = "@("+string(k)+")"; 594 } 595 BRlist[2][nvarP+1] = homvar; 596 w[nvarP +1]=1; 597 598 //ordering is set to (dp,C) if weights of all variables are 1 599 //resp. to (wp(w,1),C) where w are the ringweights of basering P 600 //homogenizing var gets weight 1: 601 602 BRlist[3] = list(); 603 BRlist[3][2]=list("C",intvec(0)); 604 if(w==1) 605 { 606 BRlist[3][1]=list("dp",w); 607 } 608 else 609 { 610 BRlist[3][1]=list("wp",w); 611 } 612 613 //change ring and get ideal from previous ring 614 def Philb = ring(quotientList(BRlist)); 615 kill BRlist; 616 setring Philb; 617 if( defined(is_qring) ) 618 { 619 ideal @Qidealhilb@ = homog( imap(P,Qideal), `homvar` ); 620 export(@Qidealhilb@); 621 622 if( find(option(),"prot") ){"add quotient ideal to input";} 623 for(k = 1; k <= s; k++) 624 { //homogenize 625 def Id(k) = homog( imap(P,Id(k)), `homvar` ); 626 Id(k) = Id(k),@Qidealhilb@*freemodule(nr(k)) ; 627 export(Id(k)); 628 } 629 } 630 else 631 { 632 for(k = 1; k <= s; k++) 633 { //homogenize 634 def Id(k) = homog( imap(P,Id(k)), `homvar` ); 635 export(Id(k)); 636 } 637 } 638 list Lhilb = Philb,w; 639 return(Lhilb); 653 640 } 654 641 example … … 679 666 EXAMPLE: example qslimgb; shows an example" 680 667 { 681 def P = basering; 682 ideal Qideal = ideal(P); //defining the quotient ideal if P is a qring 683 int p_opt; 684 if( find(option(),"prot") ) 685 { 686 p_opt=1; 687 } 688 if (size(Qideal) == 0) 689 { 690 if (p_opt) 691 { 692 "slimgb in ring " + string(P); 693 } 694 return(slimgb(i)); 695 } 696 697 //case of a qring; since slimgb does not know qrings we 698 //delete the quotient ideal and add it to i 699 700 list BRlist = ringlist(P); 701 BRlist[4] = ideal(0); 702 def Phelp = ring(BRlist); 703 kill BRlist; 704 setring Phelp; 705 // module case: 706 def iq = imap(P,i); 707 iq = iq, imap(P,Qideal)*freemodule(nrows(iq)); 708 if (p_opt) 709 { 710 "slimgb in ring " + string(Phelp); 711 "(with quotient ideal added to input)"; 712 } 713 iq = slimgb(iq); 714 715 setring P; 716 if (p_opt) 717 { 718 "//imap to original ring"; 719 } 720 i = imap(Phelp,iq); 721 kill Phelp; 722 723 if (find(option(),"redSB") > 0) 724 { 725 if (p_opt) 726 { 727 "//interreduction"; 728 } 729 i=interred(i); 730 } 731 attrib(i, "isSB", 1); 732 return (i); 668 def P = basering; 669 ideal Qideal = ideal(P); //defining the quotient ideal if P is a qring 670 int p_opt; 671 if( find(option(),"prot") ) 672 { 673 p_opt=1; 674 } 675 if (size(Qideal) == 0) 676 { 677 if (p_opt) { "slimgb in ring " + string(P); } 678 return(slimgb(i)); 679 } 680 681 //case of a qring; since slimgb does not know qrings we 682 //delete the quotient ideal and add it to i 683 684 list BRlist = ringlist(P); 685 BRlist[4] = ideal(0); 686 def Phelp = ring(BRlist); 687 kill BRlist; 688 setring Phelp; 689 // module case: 690 def iq = imap(P,i); 691 iq = iq, imap(P,Qideal)*freemodule(nrows(iq)); 692 if (p_opt) 693 { 694 "slimgb in ring " + string(Phelp); 695 "(with quotient ideal added to input)"; 696 } 697 iq = slimgb(iq); 698 699 setring P; 700 if (p_opt) { "//imap to original ring"; } 701 i = imap(Phelp,iq); 702 kill Phelp; 703 704 if (find(option(),"redSB") > 0) 705 { 706 if (p_opt) { "//interreduction"; } 707 i=interred(i); 708 } 709 attrib(i, "isSB", 1); 710 return (i); 733 711 } 734 712 example … … 788 766 KEYWORDS: time limit on computations; MP, groebner basis computations 789 767 EXAMPLE: example groebner; shows an example" 790 { 791 768 769 { 792 770 //Vorgabe einer Teilmenge aus {hilb,fglm,par2var,std,slimgb} 793 771 //Aktuelle Einstellungen (Jan 2007): … … 928 906 ideal Qideal = ideal(P); //defining the quotient ideal if P is a qring 929 907 int was_qring; //remembers if basering was a qring 930 int is_homog = homog(Qideal); //remembers if Qideal was homog (homog(0)=1)908 //int is_homog = 1; 931 909 if (size(Qideal) > 0) 932 910 { 933 911 was_qring = 1; 912 //is_homog = homog(Qideal); //remembers if Qideal was homog (homog(0)=1) 934 913 } 935 914 list BRlist = ringlist(P); … … 957 936 //local or mixed orderings, matrix orderings, extra weight vector and modules 958 937 959 if( ( find(ordstr_P,"s") > 0 )960 ||( find(ordstr_P,"M") > 0 )938 if( //( find(ordstr_P,"s") > 0 ) || // covered by neg 939 ( find(ordstr_P,"M") > 0 ) 961 940 || ( find(ordstr_P,"a") > 0 ) 962 941 || ( neg>0 ) ) … … 971 950 972 951 //------------------ classify the possible settings --------------------- 973 string algorithm; //possibilities: std, slimgb, stdorslimgb974 string conversion; //possibilities: hilb, fglm, hilborfglm, no975 string partovar; //possibilities: yes, no976 string order; //possibilities: simple, !simple977 string direct; //possibilities: yes, no952 string algorithm; //possibilities: std, slimgb, stdorslimgb 953 string conversion; //possibilities: hilb, fglm, hilborfglm, no 954 string partovar; //possibilities: yes, no 955 string order; //possibilities: simple, !simple 956 string direct; //possibilities: yes, no 978 957 979 958 //define algorithm: 980 959 if( find(method,"std") && !find(method,"slimgb") ) 981 960 { 982 961 algorithm = "std"; 983 962 } 984 963 if( find(method,"slimgb") && !find(method,"std") ) 985 964 { 986 965 algorithm = "slimgb"; 987 966 } 988 967 if( find(method,"std") && find(method,"slimgb") || 989 968 (!find(method,"std") && !find(method,"slimgb")) ) 990 969 { 991 970 algorithm = "stdorslimgb"; 992 971 } 993 972 … … 999 978 if( find(method,"fglm") && !find(method,"hilb") ) 1000 979 { 1001 980 conversion = "fglm"; 1002 981 } 1003 982 if( find(method,"fglm") && find(method,"hilb") ) 1004 983 { 1005 984 conversion = "hilborfglm"; 1006 985 } 1007 986 if( !find(method,"fglm") && !find(method,"hilb") ) 1008 987 { 1009 988 conversion = "no"; 1010 989 } 1011 990 … … 1036 1015 (find(method,"std") && find(method,"slimgb")) ) ) ) 1037 1016 { 1038 1017 direct = "yes"; 1039 1018 } 1040 1019 else 1041 1020 { 1042 1021 direct = "no"; 1043 1022 } 1044 1023 … … 1057 1036 if ( direct == "yes" ) 1058 1037 { 1059 if ( algorithm=="std" || (algorithm=="stdorslimgb" && char(P)>0) ) 1060 { 1061 if (p_opt) { "std in " + string(P); } 1062 i = std(i); 1063 return(i); 1064 } 1065 if ( algorithm=="slimgb" || (algorithm=="stdorslimgb" && char(P)==0) ) 1066 { 1067 i = qslimgb(i); 1068 return(i); 1069 } 1038 if ( algorithm=="std" || (algorithm=="stdorslimgb" && char(P)>0) ) 1039 { 1040 if (p_opt) { "std in " + string(P); } 1041 return(std(i)); 1042 } 1043 if ( algorithm=="slimgb" || (algorithm=="stdorslimgb" && char(P)==0) ) 1044 { 1045 return(qslimgb(i)); 1046 } 1070 1047 } 1071 1048 … … 1079 1056 1080 1057 //------------ case where no parameters are made to variables ------------- 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1058 if ( partovar == "no" && conversion == "hilb" 1059 || (partovar == "no" && conversion == "fglm" ) 1060 || (partovar == "no" && conversion == "hilborfglm" ) 1061 || (partovar == "no" && conversion == "no" && direct == "no") ) 1062 //last case: heuristic 1063 { 1064 if ( conversion=="fglm" ) 1065 { 1066 if ( algorithm=="std" || (algorithm=="stdorslimgb" && char(P)>0) ) 1067 { 1068 return (stdfglm(i,"std")); 1069 } 1070 if ( algorithm=="slimgb" || (algorithm=="stdorslimgb" && char(P)==0) ) 1071 { 1072 return (stdfglm(i,"slimgb")); 1073 } 1074 } 1075 else 1076 { 1077 if ( algorithm=="std" || (algorithm=="stdorslimgb" && char(P)>0) ) 1078 { 1079 return (stdhilb(i,"std")); 1080 } 1081 if ( algorithm=="slimgb" || (algorithm=="stdorslimgb" && char(P)==0) ) 1082 { 1083 return (stdhilb(i,"slimgb")); 1084 } 1085 } 1086 } 1110 1087 1111 1088 //------------ case where parameters are made to variables ---------------- 1112 1089 //define a ring Phelp via par2varRing in which the parameters are variables 1113 1090 1114 1115 1116 1117 1118 1119 1091 else 1092 { 1093 // reset options 1094 option(none); 1095 // turn on options prot, mem, redSB, intStrategy if previously set 1096 if ( find(s_opt, "prot") ) 1120 1097 { option(prot); } 1121 1098 if ( find(s_opt, "mem") ) 1122 1099 { option(mem); } 1123 1100 if ( find(s_opt, "redSB") ) 1124 1101 { option(redSB); } 1125 1102 if ( find(s_opt, "intStrategy") ) 1126 1103 { option(intStrategy); } 1127 1104 1128 is_homog = is_homog*homog(i); //check for homogeneity of i and Qideal 1129 1130 //first clear denominators of parameters 1131 if (npars_P > 0) 1105 //first clear denominators of parameters 1106 if (npars_P > 0) 1107 { 1108 for( k=ncols(i); k>0; k-- ) 1109 { i[k]=cleardenom(i[k]); } 1110 } 1111 1112 def Phelp = par2varRing(i)[1]; //minpoly is mapped with i 1113 setring Phelp; 1114 def i = Id(1); 1115 //is_homog = homog(i); 1116 1117 //If parameters are converted to ring variables, they appear in an extra 1118 //block. Therefore we use always hilb for this block ordering: 1119 if ( conversion=="fglm" ) 1120 { 1121 i = (stdfglm(i)); //only uesful for 1 parameter with minpoly 1122 } 1123 else 1124 { 1125 if ( algorithm=="std" || (algorithm=="stdorslimgb" && char(P)>0) ) 1132 1126 { 1133 for( k=ncols(i); k>0; k-- ) 1134 { i[k]=cleardenom(i[k]); } 1127 i = stdhilb(i,"std"); 1135 1128 } 1136 1137 def Phelp = par2varRing(i)[1]; //minpoly is mapped with i 1138 setring Phelp; 1139 def i = Id(1); 1140 is_homog = homog(i); 1141 1142 //If parameters are converted to ring variables, they appear in an extra 1143 //block. Therefore we use always hilb for this block ordering: 1144 if ( conversion=="fglm" ) 1129 if ( algorithm=="slimgb" || (algorithm=="stdorslimgb" && char(P)==0) ) 1145 1130 { 1146 i = (stdfglm(i)); //only uesful for 1 parameter with minpoly1131 i = stdhilb(i,"slimgb"); 1147 1132 } 1148 else 1149 { 1150 if ( algorithm=="std" || (algorithm=="stdorslimgb" && char(P)>0) ) 1151 { 1152 i = stdhilb(i,"std"); 1153 } 1154 if ( algorithm=="slimgb" || (algorithm=="stdorslimgb" && char(P)==0) ) 1155 { 1156 i = stdhilb(i,"slimgb"); 1157 } 1158 } 1159 } 1133 } 1134 } 1160 1135 1161 1136 //-------------------- go back to original ring --------------------------- … … 1164 1139 //to the basering. 1165 1140 1166 if (p_opt) 1167 { 1168 "//simplification"; 1169 } 1170 1171 if (was_minpoly) 1172 { 1173 ideal Minpoly = imap(P,Minpoly); 1174 attrib(Minpoly,"isSB",1); 1175 i = simplify(NF(i,Minpoly),2); 1176 } 1177 1178 def Li = lead(i); 1179 setring P; 1180 def Li = imap(Phelp,Li); 1181 Li = simplify(Li,32); 1182 intvec vi; 1183 for (k=1; k<=ncols(Li); k++) 1184 { 1185 vi[k] = Li[k]==0; 1186 } 1187 1188 setring Phelp; 1189 for (k=1; k<=size(i) ;k++) 1190 { 1191 if(vi[k]==1) 1192 { 1193 i[k]=0; 1194 } 1195 } 1196 i = simplify(i,2); 1197 1198 setring P; 1199 if (p_opt) 1200 { 1201 "//imap to original ring"; 1202 } 1203 i = imap(Phelp,i); 1204 kill Phelp; 1205 i = simplify(i,34); 1206 1207 // clean-up time 1208 option(set, opt); 1209 if (find(s_opt, "redSB") > 0) 1210 { 1211 if (p_opt) 1212 { 1213 "//interreduction"; 1214 } 1215 i=interred(i); 1216 } 1217 attrib(i, "isSB", 1); 1218 return (i); 1141 if (p_opt) { "//simplification"; } 1142 1143 if (was_minpoly) 1144 { 1145 ideal Minpoly = imap(P,Minpoly); 1146 attrib(Minpoly,"isSB",1); 1147 i = simplify(NF(i,Minpoly),2); 1148 } 1149 1150 def Li = lead(i); 1151 setring P; 1152 def Li = imap(Phelp,Li); 1153 Li = simplify(Li,32); 1154 intvec vi; 1155 for (k=1; k<=ncols(Li); k++) 1156 { 1157 vi[k] = Li[k]==0; 1158 } 1159 1160 setring Phelp; 1161 for (k=1; k<=size(i) ;k++) 1162 { 1163 if(vi[k]==1) 1164 { 1165 i[k]=0; 1166 } 1167 } 1168 i = simplify(i,2); 1169 1170 setring P; 1171 if (p_opt) { "//imap to original ring"; } 1172 i = imap(Phelp,i); 1173 kill Phelp; 1174 i = simplify(i,34); 1175 1176 // clean-up time 1177 option(set, opt); 1178 if (find(s_opt, "redSB") > 0) 1179 { 1180 if (p_opt) { "//interreduction"; } 1181 i=interred(i); 1182 } 1183 attrib(i, "isSB", 1); 1184 return (i); 1219 1185 } 1220 1186 example
Note: See TracChangeset
for help on using the changeset viewer.