Changeset 7a6a60 in git
- Timestamp:
- Apr 23, 2009, 11:44:58 AM (15 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 228b1c93b3768f0d85df493aa941c2e25f436cef
- Parents:
- b85587587523c7ec8f89a09d494710648e48569b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
rb85587 r7a6a60 2 2 Compute the Groebner fan of an ideal 3 3 $Author: monerjan $ 4 $Date: 2009-04-2 1 15:23:54$5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.3 7 2009-04-21 15:23:54monerjan Exp $6 $Id: gfan.cc,v 1.3 7 2009-04-21 15:23:54monerjan Exp $4 $Date: 2009-04-23 09:44:58 $ 5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.38 2009-04-23 09:44:58 monerjan Exp $ 6 $Id: gfan.cc,v 1.38 2009-04-23 09:44:58 monerjan Exp $ 7 7 */ 8 8 … … 22 22 #include "prCopy.h" 23 23 #include <iostream.h> //deprecated 24 #include <bitset> 24 25 25 26 /*remove the following at your own risk*/ … … 134 135 { 135 136 private: 136 int numFacets; //#of facets of the cone 137 137 int numFacets; //#of facets of the cone 138 ring rootRing; 139 ideal inputIdeal; //the original 138 140 public: 139 141 /** \brief Default constructor. … … 146 148 this->facetPtr=NULL; 147 149 } 150 151 gcone(ring r, ideal I) 152 { 153 this->next=NULL; 154 this->facetPtr=NULL; 155 this->rootRing=r; 156 this->inputIdeal=I; 157 } 158 148 159 ~gcone(); //destructor 149 160 … … 449 460 */ 450 461 ring srcRing=currRing; 451 ring dstRing=rCopy0(srcRing);452 dstRing->order[0]=ringorder_a;453 dstRing->wvhdl[0] =( int *)omAlloc((fNormal->length())*sizeof(int)); //found in Singular/ipshell.cc462 ring tmpRing=rCopy0(srcRing); 463 tmpRing->order[0]=ringorder_a; 464 tmpRing->wvhdl[0] =( int *)omAlloc((fNormal->length())*sizeof(int)); //found in Singular/ipshell.cc 454 465 455 466 for (int ii=0;ii<this->numVars;ii++) 456 467 { 457 dstRing->wvhdl[0][ii]=-(*fNormal)[ii]; //What exactly am I doing here?468 tmpRing->wvhdl[0][ii]=-(*fNormal)[ii]; //What exactly am I doing here? 458 469 //cout << tmpring->wvhdl[0][ii] << endl; 459 470 } 460 rComplete( dstRing);461 rChangeCurrRing( dstRing);471 rComplete(tmpRing); 472 rChangeCurrRing(tmpRing); 462 473 463 474 rWrite(currRing); cout << endl; … … 480 491 ideal srcRing_H; 481 492 ideal srcRing_HH; 482 srcRing_H=idrCopyR(H, dstRing);493 srcRing_H=idrCopyR(H,tmpRing); 483 494 idShow(srcRing_H); 484 495 srcRing_HH=ffG(srcRing_H,this->gcBasis); … … 518 529 int *dst_ExpV = (int *)omAlloc((this->numVars+1)*sizeof(int)); 519 530 pGetExpV(aktpoly,src_ExpV); 520 rChangeCurrRing( dstRing); //this ring change is crucial!531 rChangeCurrRing(tmpRing); //this ring change is crucial! 521 532 pGetExpV(pCopy(H->m[ii]),dst_ExpV); 522 533 rChangeCurrRing(srcRing); … … 548 559 else 549 560 { 550 rChangeCurrRing( dstRing);561 rChangeCurrRing(tmpRing); 551 562 pGetExpV(pHead(H->m[ii]),leadExpV); //We use H->m[ii] as leading monomial 552 563 rChangeCurrRing(srcRing); … … 586 597 } 587 598 dd_WriteMatrix(stdout,intPointMatrix); 588 interiorPoint(intPointMatrix); //TODO This should finally return an intvec 599 intvec *iv_weight = new intvec(this->numVars); 600 interiorPoint(intPointMatrix, *iv_weight); //iv_weight now contains the interior point 589 601 dd_FreeMatrix(intPointMatrix); 590 //dd_free_global_constants();602 dd_free_global_constants(); 591 603 592 604 /*Step 3 593 605 turn the minimal basis into a reduced one 594 606 */ 607 ring dstRing=rCopy0(srcRing); 608 dstRing->order[0]=ringorder_a; 609 //dstRing->order[1]=ringorder_dp; 610 dstRing->wvhdl[0] =( int *)omAlloc((iv_weight->length())*sizeof(int)); 611 for (int ii=0;ii<this->numVars;ii++) 612 { 613 dstRing->wvhdl[0][ii]=(*iv_weight)[ii]; 614 } 615 rComplete(dstRing); 616 rChangeCurrRing(dstRing); 617 rWrite(dstRing); cout << endl; 618 ideal dstRing_I; 619 //dstRing_I=idrCopyR(gb,srcRing); 620 dstRing_I=idrCopyR(srcRing_HH,srcRing); 621 //validOpts<1>=TRUE; 622 idShow(dstRing_I); 623 ideal foo; 624 BITSET save=test; 625 test|=Sy_bit(OPT_REDSB); 626 test|=Sy_bit(6); //OPT_DEBUG 627 //foo=kStd(idrCopyR(this->inputIdeal,this->rootRing),NULL,testHomog,NULL); 628 foo=kStd(dstRing_I,NULL,testHomog,NULL); 629 idShow(foo); 630 kInterRed(foo); 631 idSkipZeroes(foo); 632 idShow(foo); 633 test=save; 595 634 596 635 }//void flip(ideal gb, facet *f) … … 745 784 }//bool isParallel 746 785 747 void interiorPoint(dd_MatrixPtr &M) //no const &M here since we want to remove redundant rows786 void interiorPoint(dd_MatrixPtr const &M, intvec &iv) //no const &M here since we want to remove redundant rows 748 787 { 749 788 dd_LPPtr lp,lpInt; … … 782 821 } 783 822 784 dd_LPSolve(lpInt,solver,&err); //This will not result in a point from the relative interior823 //dd_LPSolve(lpInt,solver,&err); //This will not result in a point from the relative interior 785 824 if (err!=dd_NoError){cout << "Error during dd_LPSolve" << endl;} 786 825 //cout << "Tick 5" << endl; … … 793 832 for (int ii=1; ii<(lpSol->d)-1;ii++) 794 833 { 795 dd_WriteNumber(stdout,lpSol->sol[ii]); 834 dd_WriteNumber(stdout,lpSol->sol[ii]); 835 (iv)[ii-1]=(int)mpz_get_d(mpq_numref(lpSol->sol[ii])); //looks evil, but does the trick 796 836 } 797 837 dd_FreeLPSolution(lpSol); … … 800 840 set_free(ddlinset); 801 841 set_free(ddredrows); 842 802 843 /*At this point we have an interior point of type mpq_t 803 844 Need to convert to an intvec 845 NOTE: Resolved 804 846 */ 805 847 … … 848 890 #endif 849 891 850 gcone *gcRoot = new gcone(); //Instantiate the sink 892 //gcone *gcRoot = new gcone(); //Instantiate the sink 893 gcone *gcRoot = new gcone(rootRing,rootIdeal); 851 894 gcone *gcAct; 852 895 gcAct = gcRoot;
Note: See TracChangeset
for help on using the changeset viewer.