Changeset b1bed35 in git for kernel/gfan.cc
- Timestamp:
- Apr 17, 2009, 3:44:27 PM (15 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 694257b820eac75a8100417ebf8f059879a873fd
- Parents:
- ee5ace2b2bf7d30c23b3fce50222dcc3f12e88dc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
ree5ace rb1bed35 2 2 Compute the Groebner fan of an ideal 3 3 $Author: monerjan $ 4 $Date: 2009-04-1 6 09:59:16$5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.3 4 2009-04-16 09:59:16monerjan Exp $6 $Id: gfan.cc,v 1.3 4 2009-04-16 09:59:16monerjan Exp $4 $Date: 2009-04-17 13:44:27 $ 5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.35 2009-04-17 13:44:27 monerjan Exp $ 6 $Id: gfan.cc,v 1.35 2009-04-17 13:44:27 monerjan Exp $ 7 7 */ 8 8 … … 463 463 srcRing_H=idrCopyR(H,dstRing); 464 464 idShow(srcRing_H); 465 srcRing_HH=ffG(srcRing_H,this->gcBasis); 465 srcRing_HH=ffG(srcRing_H,this->gcBasis); 466 466 idShow(srcRing_HH); 467 467 /*Substep 2.2.1 … … 483 483 iPMatrixRows = iPMatrixRows+pLength(aktpoly)-1; 484 484 } 485 intPointMatrix = dd_CreateMatrix(iPMatrixRows,this->numVars+1); 485 /* additionally one row for the standard-simplex and another for a row that becomes 0 during 486 construction of the differences 487 */ 488 intPointMatrix = dd_CreateMatrix(iPMatrixRows+2,this->numVars+1); 486 489 487 490 for (int ii=0;ii<IDELEMS(srcRing_HH);ii++) 488 491 { 492 markingsAreCorrect=FALSE; //crucial to initialise here 489 493 poly aktpoly=srcRing_HH->m[ii]; 490 494 /*Comparison of leading monomials is done via exponent vectors*/ … … 494 498 int *dst_ExpV = (int *)omAlloc((this->numVars+1)*sizeof(int)); 495 499 pGetExpV(aktpoly,src_ExpV); 500 rChangeCurrRing(dstRing); //this ring change is crucial! 496 501 pGetExpV(pCopy(H->m[ii]),dst_ExpV); 497 cout << *src_ExpV << endl; 498 cout << *dst_ExpV << endl; 499 if (src_ExpV == dst_ExpV) 502 rChangeCurrRing(srcRing); 503 bool expVAreEqual=TRUE; 504 for (int kk=1;kk<=this->numVars;kk++) 505 { 506 cout << src_ExpV[kk] << "," << dst_ExpV[kk] << endl; 507 if (src_ExpV[kk]!=dst_ExpV[kk]) 508 { 509 expVAreEqual=FALSE; 510 } 511 } 512 //if (*src_ExpV == *dst_ExpV) 513 if (expVAreEqual==TRUE) 500 514 { 501 515 markingsAreCorrect=TRUE; //everything is fine … … 514 528 else 515 529 { 516 pGetExpV(pCopy(pHead(H->m[ii])),leadExpV); //We use H->m[ii] as leading monomial 530 rChangeCurrRing(dstRing); 531 pGetExpV(pHead(H->m[ii]),leadExpV); //We use H->m[ii] as leading monomial 532 rChangeCurrRing(srcRing); 517 533 } 518 /*compute differences of the expvects*/ 534 /*compute differences of the expvects*/ 519 535 while (pNext(aktpoly)!=NULL) 520 536 { 521 aktpoly=pNext(aktpoly); 522 pGetExpV(aktpoly,v); 537 /*The following if-else-block makes sure the first term (i.e. the wrongly marked term) 538 is not omitted when computing the differences*/ 539 if(markingsAreCorrect==TRUE) 540 { 541 aktpoly=pNext(aktpoly); 542 pGetExpV(aktpoly,v); 543 } 544 else 545 { 546 pGetExpV(pHead(aktpoly),v); 547 markingsAreCorrect=TRUE; 548 } 549 523 550 for (int jj=0;jj<this->numVars;jj++) 524 551 { 525 /*Store into ddMatrix*/ 526 /*FIXME Wrong values*/ 527 dd_set_si(intPointMatrix->matrix[aktrow][jj+1],v[jj+1]-leadExpV[jj+1]); 552 /*Store into ddMatrix*/ 553 dd_set_si(intPointMatrix->matrix[aktrow][jj+1],leadExpV[jj+1]-v[jj+1]); 528 554 } 529 555 aktrow +=1; … … 532 558 delete leadExpV; 533 559 }//for (int ii=0;ii<IDELEMS(srcRing_HH);ii++) 560 /*Now we add the constraint for the standard simplex*/ 561 /*NOTE:Might actually work without the standard simplex*/ 562 //dd_set_si(intPointMatrix->matrix[aktrow][0],100); 563 for (int jj=1;jj<=this->numVars;jj++) 564 { 565 //dd_set_si(intPointMatrix->matrix[aktrow][jj],-1); 566 } 534 567 dd_WriteMatrix(stdout,intPointMatrix); 568 interiorPoint(intPointMatrix); //TODO This should finally return an intvec 535 569 dd_FreeMatrix(intPointMatrix); 536 570 … … 548 582 * compute the factors \f$ a_i \f$ 549 583 */ 584 //NOTE: Should be replaced by kNF or kNF2 550 585 poly restOfDiv(poly const &f, ideal const &I) 551 586 { … … 614 649 /** \brief Compute \f$ f-f^{\mathcal{G}} \f$ 615 650 */ 651 //NOTE: use kNF or kNF2 instead of restOfDivision 616 652 ideal ffG(ideal const &H, ideal const &G) 617 653 { … … 623 659 { 624 660 res->m[ii]=restOfDiv(H->m[ii],G); 661 //res->m[ii]=kNF(H->m[ii],G); 625 662 temp1=H->m[ii]; 626 663 temp2=res->m[ii]; … … 631 668 //pSetm(res->m[ii]); 632 669 cout << "res->m["<<ii<<"]=";pWrite(res->m[ii]); 633 } 670 } 634 671 return res; 635 672 } … … 686 723 } 687 724 }//bool isParallel 725 726 void interiorPoint(dd_MatrixPtr &M) //no const &M here since we want to remove redundant rows 727 { 728 dd_LPPtr lp,lpInt; 729 dd_ErrorType err=dd_NoError; 730 dd_LPSolverType solver=dd_DualSimplex; 731 dd_LPSolutionPtr lpSol; 732 dd_rowset ddlinset,ddredrows; 733 dd_rowindex ddnewpos; 734 dd_NumberType numb; 735 numb=dd_Integer; 736 737 M->numbtype=numb; 738 dd_MatrixCanonicalize(&M, &ddlinset, &ddredrows, &ddnewpos, &err); 739 dd_WriteMatrix(stdout,M); 740 741 lp=dd_Matrix2LP(M, &err); 742 lpInt=dd_MakeLPforInteriorFinding(lp); 743 dd_LPSolve(lpInt,solver,&err); 744 lpSol=dd_CopyLPSolution(lpInt); 745 lpSol->numbtype=numb; 746 cout << "Interior point: "; 747 for (int ii=1; ii<(lpSol->d)-1;ii++) 748 { 749 dd_WriteNumber(stdout,lpSol->sol[ii]); 750 } 751 dd_FreeLPData(lp); 752 dd_FreeLPSolution(lpSol); 753 dd_FreeLPData(lpInt); 754 }//void interiorPoint(dd_MatrixPtr const &M) 688 755 };//class gcone 689 756
Note: See TracChangeset
for help on using the changeset viewer.