Changeset ae5056 in git
- Timestamp:
- Jun 16, 2009, 10:45:33 AM (14 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- 8e5a5b4f1f2f9bf6f4661d12232c26be179b09f3
- Parents:
- e28cf1ea73e36a7c3768b1ea8eb0e279b22ecede
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
re28cf1 rae5056 2 2 Compute the Groebner fan of an ideal 3 3 $Author: monerjan $ 4 $Date: 2009-06-1 4 10:00:14$5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.6 0 2009-06-14 10:00:14monerjan Exp $6 $Id: gfan.cc,v 1.6 0 2009-06-14 10:00:14monerjan Exp $4 $Date: 2009-06-16 08:45:33 $ 5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.61 2009-06-16 08:45:33 monerjan Exp $ 6 $Id: gfan.cc,v 1.61 2009-06-16 08:45:33 monerjan Exp $ 7 7 */ 8 8 … … 192 192 void setFlipGB(ideal I) 193 193 { 194 this->flipGB= I;194 this->flipGB=idCopy(I); 195 195 } 196 196 … … 374 374 this->next=NULL; 375 375 this->numVars=gc.numVars; 376 this->UCN=(gc.UCN)+1; 376 //this->UCN=(gc.UCN)+1; 377 this->UCN++; 377 378 this->facetPtr=NULL; 378 this->gcBasis=gc.gcBasis; 379 this->baseRing=f.flipRing; 380 rChangeCurrRing(this->baseRing); 379 this->gcBasis=idCopy(f.flipGB); 380 this->inputIdeal=idCopy(this->gcBasis); 381 this->baseRing=rCopy0(f.flipRing); 382 //rComplete(this->baseRing); 383 //rChangeCurrRing(this->baseRing); 381 384 } 382 385 … … 405 408 } 406 409 410 /** \brief Print facets 411 * This is mainly for debugging purposes. Usually called from within gdb 412 */ 407 413 void showFacets(short codim=1) 408 414 { … … 788 794 compute $G_{-\alpha}(in_v(I)) 789 795 see journal p. 66 796 NOTE Check for different rings. Prolly it will not always be necessary to add a weight, if the 797 srcRing already has a weighted ordering 790 798 */ 791 799 ring srcRing=currRing; 800 ring tmpRing; 792 801 793 802 //intvec *negfNormal = new intvec(this->numVars); 794 803 //negfNormal=ivNeg(fNormal); 795 ring tmpRing=rCopyAndAddWeight(srcRing,ivNeg(fNormal)); 804 if( (srcRing->order[0]==ringorder_dp) 805 || (srcRing->order[0]==ringorder_Dp) 806 || (srcRing->order[0]==ringorder_ds) 807 || (srcRing->order[0]==ringorder_ls) ) 808 { 809 tmpRing=rCopyAndAddWeight(srcRing,ivNeg(fNormal)); 810 } 811 else 812 { 813 tmpRing=rCopy0(srcRing); 814 int length=fNormal->length(); 815 int *A=(int *)omAlloc(length*sizeof(int)); 816 for(int jj=0;jj<length;jj++) 817 { 818 A[jj]=-(*fNormal)[jj]; 819 } 820 tmpRing->wvhdl[0]=(int*)A; 821 rComplete(tmpRing); 822 } 796 823 rChangeCurrRing(tmpRing); 797 824 … … 940 967 turn the minimal basis into a reduced one 941 968 */ 942 ring dstRing=rCopyAndAddWeight(tmpRing,iv_weight);969 //ring dstRing=rCopyAndAddWeight(tmpRing,iv_weight); 943 970 944 971 // int i,j; … … 977 1004 dstRing->wvhdl[0][ii]=(*iv_weight)[ii]; 978 1005 }*/ 1006 ring dstRing=rCopy0(tmpRing); 1007 int length=iv_weight->length(); 1008 int *A=(int *)omAlloc(length*sizeof(int)); 1009 for(int jj=0;jj<length;jj++) 1010 { 1011 A[jj]=(*iv_weight)[jj]; 1012 } 1013 dstRing->wvhdl[0]=(int*)A; 1014 rComplete(dstRing); 1015 //rSetWeightVec(dstRing,iv_weight); 1016 //assume(dstRing!=NULL); 1017 //assume(dstRing->OrdSize>0); 1018 //assume(dstRing->typ[0].ord_typ==ro_dp); 1019 //memcpy(dstRing->typ[0].data.wp.weights,iv_weight,dstRing->N*sizeof(int)); 979 1020 rChangeCurrRing(dstRing); 1021 980 1022 #ifdef gfan_DEBUG 981 1023 rWrite(dstRing); cout << endl; … … 990 1032 test|=Sy_bit(OPT_REDSB); 991 1033 test|=Sy_bit(6); //OPT_DEBUG 992 dstRing_I=kStd(idrCopyR(this->inputIdeal,this-> rootRing),NULL,testHomog,NULL);1034 dstRing_I=kStd(idrCopyR(this->inputIdeal,this->baseRing),NULL,testHomog,NULL); 993 1035 kInterRed(dstRing_I); 994 1036 idSkipZeroes(dstRing_I); … … 997 1039 998 1040 f->setFlipGB(dstRing_I);//store the flipped GB 999 f->flipRing= dstRing; //store the ring on the other side1041 f->flipRing=rCopy0(dstRing); //store the ring on the other side 1000 1042 #ifdef gfan_DEBUG 1001 1043 cout << "Flipped GB is: " << endl; 1002 1044 f->printFlipGB(); 1003 1045 #endif 1004 //rChangeCurrRing(srcRing); //return to the ring we started the computation of flipGB in1046 rChangeCurrRing(srcRing); //return to the ring we started the computation of flipGB in 1005 1047 }//void flip(ideal gb, facet *f) 1006 1048 … … 1223 1265 dd_WriteNumber(stdout,lpSol->sol[ii]); 1224 1266 } 1267 cout << endl; 1225 1268 #endif 1226 1269 … … 1249 1292 mpq_clear(product); 1250 1293 } 1294 #ifdef gfan_DEBUG 1295 iv.show(); 1296 cout << endl; 1297 #endif 1251 1298 mpq_clear(qkgV); 1252 1299 mpz_clear(tmp); … … 1522 1569 * soon as we compute this facet again. Comparison of facets is done by... 1523 1570 */ 1524 void noRevS(gcone &gc , bool usingIntPoint=FALSE)1571 void noRevS(gcone &gcRoot, bool usingIntPoint=FALSE) 1525 1572 { 1526 1573 facet *SearchListRoot = new facet(); //The list containing ALL facets we come across … … 1528 1575 SearchListAct = SearchListRoot; 1529 1576 1577 gcone *gcAct; 1578 gcAct = &gcRoot; 1579 gcone = *gcPtr; 1580 gcPtr = &gcRoot; 1581 1530 1582 facet *fAct; 1531 fAct = gc.facetPtr; 1532 1583 fAct = gcAct->facetPtr; 1584 1585 int UCNcounter=gcAct->getUCN(); 1533 1586 #ifdef gfan_DEBUG 1534 1587 cout << "NoRevs" << endl; 1535 1588 cout << "Facets are:" << endl; 1536 gc .showFacets();1589 gcAct->showFacets(); 1537 1590 #endif 1538 1591 1539 this->getCodim2Normals(gc);1592 gcAct->getCodim2Normals(*gcAct); 1540 1593 1541 1594 //Compute unique representation of codim-2-facets 1542 this->normalize();1595 gcAct->normalize(); 1543 1596 1544 1597 /*Make a copy of the facet list of first cone … … 1555 1608 SearchListAct = SearchListRoot; //Set to beginning of list 1556 1609 1557 fAct = gc .facetPtr;1610 fAct = gcAct->facetPtr; 1558 1611 if(areEqual(fAct->getFacetNormal(),fAct->next->getFacetNormal())) 1559 1612 { … … 1561 1614 } 1562 1615 1563 gc.writeConeToFile(gc); 1564 1616 gcAct->writeConeToFile(*gcAct); 1617 1618 /*End of initialisation*/ 1619 fAct = gcAct->facetPtr; 1565 1620 /*2nd step 1566 1621 Choose a facet from fListPtr, flip it and forget the previous cone … … 1568 1623 */ 1569 1624 while(SearchListAct->next!=NULL) 1570 { 1571 gc.flip(gc.gcBasis,SearchListAct); 1572 gcone *gcTmp = new gcone::gcone(gc,*SearchListAct); 1573 1574 //gcTmp->getConeNormals(); 1625 {//NOTE See to it that the cone is only changed after ALL facets have been flipped! 1626 //As of now this is not the case! 1627 gcAct->flip(gcAct->gcBasis,SearchListAct); 1628 /*ring rTmp=rCopy(SearchListAct->flipRing); 1629 //NOTE It is absolutely crucial to go to the new ring before constructing a new cone! 1630 rComplete(rTmp); 1631 rChangeCurrRing(rTmp); 1632 gcone *gcTmp = new gcone::gcone(*gcAct,*SearchListAct); 1633 gcAct = gcTmp; 1634 gcAct->getConeNormals(gcAct->gcBasis, FALSE);*/ 1635 //gcAct->getCodim2Normals(*gcAct); 1636 1575 1637 //add new facets 1576 1638 //fListPtr = fListPtr->next; 1577 1639 SearchListAct = SearchListAct->next; 1578 } 1640 } 1579 1641 1580 1642 //NOTE Hm, comment in and get a crash for free...
Note: See TracChangeset
for help on using the changeset viewer.