Changeset 2126c0d in git
- Timestamp:
- Jun 29, 2009, 4:46:58 PM (14 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '00e2e9c41af3fde1273eb3633f4c0c7c3db2579d')
- Children:
- 7379a771e910d618071fc586a19837c93dd9e01e
- Parents:
- 832b70058672520c5e80a49ba96723f3a316ad73
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
r832b70 r2126c0d 2 2 Compute the Groebner fan of an ideal 3 3 $Author: monerjan $ 4 $Date: 2009-06-2 5 08:52:03$5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.6 7 2009-06-25 08:52:03monerjan Exp $6 $Id: gfan.cc,v 1.6 7 2009-06-25 08:52:03monerjan Exp $4 $Date: 2009-06-29 14:46:58 $ 5 $Header: /exports/cvsroot-2/cvsroot/kernel/gfan.cc,v 1.68 2009-06-29 14:46:58 monerjan Exp $ 6 $Id: gfan.cc,v 1.68 2009-06-29 14:46:58 monerjan Exp $ 7 7 */ 8 8 … … 397 397 this->gcBasis=idCopy(f.flipGB); 398 398 this->inputIdeal=idCopy(this->gcBasis); 399 this->baseRing=rCopy 0(f.flipRing);399 this->baseRing=rCopy(f.flipRing); 400 400 this->numFacets=0; 401 401 //rComplete(this->baseRing); … … 587 587 588 588 #ifdef gfan_DEBUG 589 cout << "The inequality matrix is" << endl;590 dd_WriteMatrix(stdout, ddineq);589 cout << "The inequality matrix is" << endl; 590 dd_WriteMatrix(stdout, ddineq); 591 591 #endif 592 592 … … 608 608 ddcols = ddineq->colsize; 609 609 #ifdef gfan_DEBUG 610 cout << "Having removed redundancies, the normals now read:" << endl;611 dd_WriteMatrix(stdout,ddineq);612 cout << "Rows = " << ddrows << endl;613 cout << "Cols = " << ddcols << endl;610 cout << "Having removed redundancies, the normals now read:" << endl; 611 dd_WriteMatrix(stdout,ddineq); 612 cout << "Rows = " << ddrows << endl; 613 cout << "Cols = " << ddcols << endl; 614 614 #endif 615 615 … … 744 744 745 745 #ifdef gfan_DEBUG 746 // dd_WriteMatrix(stdout,ddakt); 746 // cout << "Codim2 matrix"<<endl; 747 // dd_WriteMatrix(stdout,ddakt); 747 748 #endif 748 749 ddpolyh=dd_DDMatrix2Poly(ddakt, &err); 749 750 P=dd_CopyGenerators(ddpolyh); 750 751 #ifdef gfan_DEBUG 751 // dd_WriteMatrix(stdout,P);752 // dd_WriteMatrix(stdout,P); 752 753 #endif 753 754 … … 807 808 std::cout << "===" << std::endl; 808 809 std::cout << "running gcone::flip" << std::endl; 809 // std::cout << "fNormal="; 810 // fNormal->show(); 811 // std::cout << std::endl; 810 std::cout << "flipping" << endl; 811 for(int ii=0;ii<IDELEMS(gb);ii++) 812 { 813 pWrite((poly)gb->m[ii]); 814 } 815 cout << "over facet" << endl; 816 fNormal->show(); 817 std::cout << std::endl; 812 818 #endif 813 819 /*1st step: Compute the initial ideal*/ … … 902 908 ina=idrCopyR(initialForm,srcRing); 903 909 #ifdef gfan_DEBUG 904 cout << "ina=";905 idShow(ina); cout << endl;910 // cout << "ina="; 911 // idShow(ina); cout << endl; 906 912 #endif 907 913 ideal H; … … 910 916 idSkipZeroes(H); 911 917 #ifdef gfan_DEBUG 912 cout << "H="; idShow(H); cout << endl;918 // cout << "H="; idShow(H); cout << endl; 913 919 #endif 914 920 /*Substep 2.2 … … 920 926 srcRing_H=idrCopyR(H,tmpRing); 921 927 #ifdef gfan_DEBUG 922 cout << "srcRing_H = ";923 idShow(srcRing_H); cout << endl;928 // cout << "srcRing_H = "; 929 // idShow(srcRing_H); cout << endl; 924 930 #endif 925 931 srcRing_HH=ffG(srcRing_H,this->gcBasis); 926 932 #ifdef gfan_DEBUG 927 cout << "srcRing_HH = ";928 idShow(srcRing_HH); cout << endl;933 // cout << "srcRing_HH = "; 934 // idShow(srcRing_HH); cout << endl; 929 935 #endif 930 936 /*Substep 2.2.1 … … 1033 1039 dd_set_si(intPointMatrix->matrix[aktrow][jj],1); 1034 1040 } 1035 dd_WriteMatrix(stdout,intPointMatrix); 1041 #ifdef gfan_DEBUG 1042 // dd_WriteMatrix(stdout,intPointMatrix); 1043 #endif 1036 1044 intvec *iv_weight = new intvec(this->numVars); 1037 1045 interiorPoint(intPointMatrix, *iv_weight); //iv_weight now contains the interior point … … 1081 1089 ring dstRing=rCopy0(tmpRing); 1082 1090 int length=iv_weight->length(); 1083 int *A=(int *)omAlloc (length*sizeof(int));1091 int *A=(int *)omAlloc0(length*sizeof(int)); 1084 1092 for(int jj=0;jj<length;jj++) 1085 1093 { … … 1116 1124 1117 1125 f->setFlipGB(dstRing_I);//store the flipped GB 1118 f->flipRing=rCopy 0(dstRing); //store the ring on the other side1126 f->flipRing=rCopy(dstRing); //store the ring on the other side 1119 1127 #ifdef gfan_DEBUG 1120 1128 cout << "Flipped GB is: " << endl; … … 1134 1142 poly restOfDiv(poly const &f, ideal const &I) 1135 1143 { 1136 cout << "Entering restOfDiv" << endl;1144 // cout << "Entering restOfDiv" << endl; 1137 1145 poly p=f; 1138 1146 //pWrite(p); … … 1196 1204 ideal ffG(ideal const &H, ideal const &G) 1197 1205 { 1198 cout << "Entering ffG" << endl;1206 // cout << "Entering ffG" << endl; 1199 1207 int size=IDELEMS(H); 1200 1208 ideal res=idInit(size,1); … … 1725 1733 SearchListAct = fAct->next; 1726 1734 } 1727 1728 // while(SearchListAct->next!=NULL)1729 // {1730 // fAct = SearchListAct;1731 // do1732 // {1733 // gcAct->flip(gcAct->gcBasis,fAct);1734 // ring rTmp = rCopy(fAct->flipRing);1735 // rComplete(rTmp);1736 // rChangeCurrRing(rTmp);1737 // gcone *gcTmp = new gcone(*gcAct,*fAct);1738 // gcTmp->getConeNormals(gcTmp->gcBasis,FALSE);1739 // gcTmp->getCodim2Normals(*gcTmp);1740 // gcPtr->next = gcTmp;1741 // gcPtr = gcPtr->next;1742 // /*add facets to SLA here*/1743 // rChangeCurrRing(gcAct->baseRing);1744 // fAct = fAct->next;1745 // }while( (fAct->next!=NULL) && (fAct->getUCN()==fAct->next->getUCN()));1746 // SearchListAct = SearchListAct->next;//fAct;1747 // }1748 1749 // while(SearchListAct->next!=NULL)1750 // {1751 // gcAct->flip(gcAct->gcBasis,SearchListAct);1752 // ring rTmp=rCopy(fAct->flipRing);1753 // rComplete(rTmp);1754 // rChangeCurrRing(rTmp);1755 // gcone *gcTmp = new gcone(*gcAct,*SearchListAct);1756 // gcTmp->getConeNormals(gcTmp->gcBasis,FALSE);1757 // gcTmp->getCodim2Normals(*gcTmp);1758 // rChangeCurrRing(gcAct->baseRing);1759 // SearchListAct = SearchListAct->next;1760 //1761 // //gcone *gcNew = new gcone(SearchListAct->flipRing,SearchListAct->flipGB);1762 // //gcAct = gcNew;1763 // }1764 1735 1765 1736 //NOTE Hm, comment in and get a crash for free... … … 1802 1773 } 1803 1774 1775 //Check whether denom is all ones, in which case we will divide out the gcd of the nominators 1776 // mpz_t checksum; mpz_t rop; 1777 // mpz_init(checksum); 1778 // mpz_init(rop); 1779 // bool divideOutGcd=FALSE; 1780 // for(int ii=0;ii<this->numVars;ii++) 1781 // { 1782 // mpz_add(rop, checksum, denom[ii]); 1783 // mpz_set(checksum, rop); 1784 // } 1785 // if( (int)mpz_get_ui(checksum)==this->numVars) 1786 // { 1787 // divideOutGcd=TRUE; 1788 // } 1789 1804 1790 /*Compute lcm of the denominators*/ 1805 1791 mpz_set(tmp,denom[0]); … … 1833 1819 } 1834 1820 /** 1835 * We compute the gcd of the components of the codim-2-facetsand1836 * multiply the each codim-2facet by it. Thus we get a normalized representation of each1837 * (codim-2)-facet normal .1821 * For all codim-2-facets we compute the gcd of the components of the facet normal and 1822 * divide it out. Thus we get a normalized representation of each 1823 * (codim-2)-facet normal, i.e. a primitive vector 1838 1824 */ 1839 1825 void normalize() … … 1852 1838 ggT = intgcd(ggT,(*n)[ii]); 1853 1839 } 1840 for(int ii=0;ii<this->numVars;ii++) 1841 { 1842 (*n)[ii] = ((*n)[ii])/ggT; 1843 } 1854 1844 codim2Act = codim2Act->next; 1855 1845 } 1856 1846 //delete n; 1857 codim2Act = this->facetPtr->codim2Ptr; //reset to start of linked list 1858 //while(codim2Act->next!=NULL) 1847 /*codim2Act = this->facetPtr->codim2Ptr; //reset to start of linked list 1859 1848 while(codim2Act!=NULL) 1860 { 1861 //intvec *n = new intvec(this->numVars); 1849 { 1862 1850 n=codim2Act->getFacetNormal(); 1863 1851 intvec *new_n = new intvec(this->numVars); … … 1870 1858 //delete n; 1871 1859 //delete new_n; 1872 } 1860 } */ 1873 1861 } 1874 1862 /** … … 1885 1873 facet *codim2Act; 1886 1874 codim2Act = this->facetPtr->codim2Ptr; 1875 facet *sl2Act; 1876 sl2Act = f.codim2Ptr; 1887 1877 bool doNotAdd=FALSE; 1888 1878 while(slEnd->next!=NULL) … … 1902 1892 while(slAct!=NULL) 1903 1893 { 1904 slNormal = slAct->getFacetNormal(); 1905 /*if(!isParallel(fNormal,slNormal)) 1906 { 1907 slEnd->next = new facet(); 1908 slEnd = slEnd->next; 1909 slEnd->setUCN(this->getUCN()); 1910 slEnd->setFacetNormal(fNormal); 1911 break; 1912 1913 } 1914 else 1915 { 1916 //NOTE check codim2facets here 1917 break; //hopefully breaks the while loop 1918 }*/ 1894 slNormal = slAct->getFacetNormal(); 1895 /*If the normals are parallel we check whether the 1896 codim-2-normals coincide as well*/ 1919 1897 if(isParallel(fNormal,slNormal)) 1920 1898 { 1921 1899 //NOTE check codim2facets here 1922 doNotAdd=TRUE; 1900 // while(codim2Act!=NULL) 1901 // { 1902 // f2Normal = codim2Act->getFacetNormal(); 1903 // sl2Act = f.codim2Ptr; 1904 // while(sl2Act!=NULL) 1905 // { 1906 // sl2Normal = sl2Act->getFacetNormal(); 1907 // if(!isParallel(f2Normal,sl2Normal)) 1908 // { 1909 // doNotAdd=FALSE; 1910 // break; 1911 // } 1912 // sl2Act = sl2Act->next; 1913 // } 1914 // if(doNotAdd==FALSE) 1915 // break; 1916 // codim2Act = codim2Act->next; 1917 // 1918 // } 1919 doNotAdd=FALSE; 1923 1920 break; 1924 1921 } … … 1975 1972 1976 1973 int jj=0; 1977 while(fAct->next!=NULL) 1974 //while(fAct->next!=NULL) 1975 while(fAct!=NULL) 1978 1976 { 1979 1977 intvec *comp; … … 2037 2035 2038 2036 gcOutputFile << "FACETS" << endl; 2039 while(fAct->next!=NULL) 2037 //while(fAct->next!=NULL) 2038 while(fAct!=NULL) 2040 2039 { 2041 2040 intvec *iv = new intvec(gc.numVars);
Note: See TracChangeset
for help on using the changeset viewer.