Changeset 864fc2 in git
- Timestamp:
- Apr 8, 2009, 4:02:26 PM (14 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'f875bbaccd0831e36aaed09ff6adeb3eb45aeb94')
- Children:
- e7778adedbf4b7cd363cb88f576d7b16023f2ca3
- Parents:
- 7e96fe079ce8711823d420d4b4ba8e959e156a77
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
r7e96fe r864fc2 2 2 Compute the Groebner fan of an ideal 3 3 $Author: monerjan $ 4 $Date: 2009-04-0 7 09:44:20$5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.3 0 2009-04-07 09:44:20monerjan Exp $6 $Id: gfan.cc,v 1.3 0 2009-04-07 09:44:20monerjan Exp $4 $Date: 2009-04-08 14:02:26 $ 5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.31 2009-04-08 14:02:26 monerjan Exp $ 6 $Id: gfan.cc,v 1.31 2009-04-08 14:02:26 monerjan Exp $ 7 7 */ 8 8 … … 12 12 13 13 #include "kstd1.h" 14 #include "kutil.h" 14 15 #include "intvec.h" 15 16 #include "polys.h" … … 18 19 #include "fast_maps.h" //Mapping of ideals 19 20 #include "maps.h" 21 #include "ring.h" 22 #include "prCopy.h" 20 23 #include "iostream.h" //deprecated 21 24 … … 438 441 rComplete(dstRing); 439 442 rChangeCurrRing(dstRing); 440 map theMap=(map)idMaxIdeal(1);443 //map theMap=(map)idMaxIdeal(1); 441 444 rWrite(currRing); cout << endl; 442 445 ideal ina; 443 ina=fast_map(initialForm,srcRing,(ideal)theMap,dstRing); 446 //ina=fast_map(initialForm,srcRing,(ideal)theMap,dstRing); 447 ina=idrCopyR(initialForm,srcRing); 444 448 cout << "ina="; 445 449 idShow(ina); cout << endl; … … 455 459 ideal srcRing_HH; 456 460 //map theMap = (map)idMaxIdeal(1); 457 srcRing_H=fast_map(H,dstRing,(ideal)theMap,srcRing); 458 srcRing_HH=srcRing_H-stdred(srcRing_H,this->gcBasis); 461 //srcRing_H=fast_map(H,dstRing,(ideal)theMap,srcRing); 462 srcRing_H=idrCopyR(H,dstRing); 463 idShow(srcRing_H); 464 srcRing_HH=ffG(srcRing_H,this->gcBasis); 465 idShow(srcRing_HH); 459 466 /*Substep 2.3 460 467 turn the minimal basis into a reduced one … … 463 470 }//void flip(ideal gb, facet *f) 464 471 472 /** \brief Compute the remainder of a polynomial by a given ideal 473 * 474 * Compute \f$ f^{\mathcal{G}} \f$ 475 * Algorithm is taken from Cox, Little, O'Shea, IVA 2nd Ed. p 62 476 * However, since we are only interested in the remainder, there is no need to 477 * compute the factors \f$ a_i \f$ 478 */ 479 poly restOfDiv(poly const &f, ideal const &I) 480 { 481 cout << "Entering restOfDiv" << endl; 482 poly p=f; 483 pWrite(p); 484 //poly r=kCreateZeroPoly(,currRing,currRing); //The 0-polynomial, hopefully 485 poly r=0; 486 int ii; 487 bool divOccured; 488 cout << "TICK 1" << endl; //Hangs after this line. Zeropoly stuff 489 while (pHead(p)!=NULL) 490 { 491 ii=1; 492 divOccured=TRUE; 493 while( (ii<=IDELEMS(I) && (divOccured==FALSE) )) 494 { 495 cout << "TICK 2" << endl; 496 if (pLmDivisibleBy(I->m[ii],p)) 497 { 498 cout << "TICK 3" << endl; 499 p=pSub(p,pMult( pDivide(pHead(p),pHead(I->m[ii])), I->m[ii])); 500 cout << "TICK 4" << endl; 501 pWrite(p); 502 pSetm(p); 503 divOccured=TRUE; 504 } 505 else 506 { 507 ii += 1; 508 }//if (pLmDivisibleBy(I->m[ii],p,currRing)) 509 if (divOccured==FALSE) 510 { 511 cout << "TICK 5" << endl; 512 r=pAdd(r,pHead(p)); 513 cout << "TICK 6" << endl; 514 p=pSub(p,pHead(p)); 515 cout << "TICK 7" << endl; 516 pWrite(p); 517 }//if (divOccured==FALSE) 518 }//while( (ii<IDELEMS(I) && (divOccured==FALSE) )) 519 }//while (p!=0) 520 return r; 521 }//poly restOfDiv(poly const &f, ideal const &I) 522 523 /** \brief Compute \f$ f-f^{\mathcal{G}} \f$ 524 */ 525 ideal ffG(ideal const &H, ideal const &G) 526 { 527 cout << "Entering ffG" << endl; 528 int size=IDELEMS(G); 529 ideal res=idInit(size,1); 530 for (int ii=0;ii<size;ii++) 531 { 532 res->m[ii]=restOfDiv(H->m[ii],G); 533 } 534 return res; 535 } 536 465 537 /** \brief Compute a Groebner Basis 466 538 * … … 537 609 /* Construct a new ring which will serve as our root 538 610 Does not yet work as expected. Will work fine with order dp,Dp but otherwise hangs in getGB 611 resolved 07.04.2009 MM 539 612 */ 540 613 rootRing=rCopy0(currRing); … … 545 618 /* Fetch the inputIdeal into our rootRing */ 546 619 map theMap=(map)idMaxIdeal(1); //evil hack! 547 //idShow(idMaxIdeal(1)); 548 /*for (int ii=0;ii<pVariables;ii++) 549 { 550 theMap->m[ii]=inputIdeal->m[ii]; 551 }*/ 552 theMap->preimage=NULL; 620 theMap->preimage=NULL; //neccessary? 553 621 ideal rootIdeal; 554 622 rootIdeal=fast_map(inputIdeal,inputRing,(ideal)theMap, currRing);
Note: See TracChangeset
for help on using the changeset viewer.