Changeset 42660f in git
- Timestamp:
- Dec 8, 2009, 6:18:09 PM (13 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- 49322598c9584a3eeea285d54df58555dad65365
- Parents:
- 44b47da220f802c0fbdacb637c0db51c885e3b6f
- Location:
- kernel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/gfan.cc
r44b47d r42660f 12 12 13 13 #include "kstd1.h" 14 #include "kutil.h" 15 #include "intvec.h"14 #include "kutil.h" //ksCreateSpoly 15 // #include "intvec.h" 16 16 #include "polys.h" 17 17 #include "ideals.h" 18 #include "kmatrix.h"18 // #include "kmatrix.h" 19 19 //#include "fast_maps.h" //Mapping of ideals 20 #include "maps.h"21 #include "ring.h" 22 #include "structs.h"20 // #include "maps.h" 21 // #include "ring.h" //apparently not needed 22 // #include "structs.h" 23 23 #include "../Singular/lists.h" 24 #include "prCopy.h" 24 #include "prCopy.h" //Needed for idrCopyR 25 25 #include <iostream> 26 #include <bitset>26 // #include <bitset> 27 27 #include <fstream> //read-write cones to files 28 #include <gmp.h>28 // #include <gmp.h> 29 29 #include <string> 30 30 #include <sstream> 31 31 #include <time.h> 32 32 #include <sys/time.h> 33 33 //#include <gmpxx.h> 34 34 … … 69 69 #endif 70 70 #endif 71 71 #define gfanp 72 72 #include <gfan.h> 73 73 using namespace std; … … 621 621 inline void gcone::getConeNormals(const ideal &I, bool compIntPoint) 622 622 { 623 #ifdef gfanp 624 timeval start, end; 625 gettimeofday(&start, 0); 626 #endif 623 627 poly aktpoly; 624 628 int rows; // will contain the dimensions of the ineq matrix - deprecated by … … 650 654 //simpler version of storing expvect diffs 651 655 int *leadexpv=(int*)omAlloc(((this->numVars)+1)*sizeof(int)); 652 int *tailexpv=(int*)omAlloc(((this->numVars)+1)*sizeof(int));656 // int *tailexpv=(int*)omAlloc(((this->numVars)+1)*sizeof(int)); 653 657 pGetExpV(aktpoly,leadexpv); 654 658 while(pNext(aktpoly)!=NULL) 655 659 { 656 660 aktpoly=pNext(aktpoly); 661 int *tailexpv=(int*)omAlloc(((this->numVars)+1)*sizeof(int)); 657 662 pGetExpV(aktpoly,tailexpv); 658 663 for(int kk=1;kk<=this->numVars;kk++) … … 661 666 } 662 667 aktmatrixrow += 1; 663 }664 omFree(tailexpv);668 omFree(tailexpv); 669 } 665 670 omFree(leadexpv); 666 671 } //for … … 891 896 set_free(ddredrows); 892 897 set_free(ddlinset); 893 //free(ddnewpos); 898 free(ddnewpos); 899 #ifdef gfanp 900 gettimeofday(&end, 0); 901 time_getConeNormals += (end.tv_sec - start.tv_sec + 1e-6*(end.tv_usec - start.tv_usec)); 902 #endif 894 903 895 904 … … 901 910 * the facet is marked as non-flippable. 902 911 */ 903 inline void gcone::getCodim2Normals(gcone const &gc) 904 { 912 inline void gcone::getCodim2Normals(const gcone &gc) 913 { 914 #ifdef gfanp 915 timeval start, end; 916 gettimeofday(&start, 0); 917 #endif 905 918 //this->facetPtr->codim2Ptr = new facet(2); //instantiate a (codim-2)-facet 906 919 facet *fAct; … … 908 921 facet *codim2Act; 909 922 //codim2Act = this->facetPtr->codim2Ptr; 910 dd_MatrixPtr ddineq,P,ddakt; 911 dd_rowset impl_linset, redset; 923 dd_MatrixPtr ddineq;//,P,ddakt; 912 924 dd_ErrorType err; 913 dd_rowindex newpos;914 915 925 //ddineq = facets2Matrix(gc); //get a matrix representation of the cone 916 926 ddineq = dd_CopyMatrix(gc.ddFacets); 917 918 927 /*Now set appropriate linearity*/ 919 dd_PolyhedraPtr ddpolyh;920 928 for (int ii=0; ii<this->numFacets; ii++) 921 { 922 ddakt = dd_CopyMatrix(ddineq); 929 { 930 // dd_rowset LL; 931 // set_initialize(&LL,ddineq->rowsize); 932 // set_copy(LL,ddineq->linset); 933 // set_copy(ddineq->linset,LL); 934 dd_rowset impl_linset, redset; 935 dd_rowindex newpos; 936 dd_MatrixPtr ddakt; 937 ddakt = dd_CopyMatrix(ddineq); 923 938 ddakt->representation=dd_Inequality; 924 set_addelem(ddakt->linset,ii+1);/*Now set appropriate linearity*/ 925 dd_MatrixCanonicalize(&ddakt, &impl_linset, &redset, &newpos, &err); 939 set_addelem(ddakt->linset,ii+1);/*Now set appropriate linearity*/ 940 #ifdef gfanp 941 timeval t_ddMC_start, t_ddMC_end; 942 gettimeofday(&t_ddMC_start,0); 943 #endif 944 dd_MatrixCanonicalize(&ddakt, &impl_linset, &redset, &newpos, &err); 945 // set_copy(LL,ddakt->linset); 946 dd_PolyhedraPtr ddpolyh; 926 947 ddpolyh=dd_DDMatrix2Poly(ddakt, &err); 927 P=dd_CopyGenerators(ddpolyh); 948 dd_MatrixPtr P; 949 P=dd_CopyGenerators(ddpolyh); 950 dd_FreePolyhedra(ddpolyh); 951 #ifdef gfanp 952 gettimeofday(&t_ddMC_end,0); 953 t_ddMC += (t_ddMC_end.tv_sec - t_ddMC_start.tv_sec + 1e-6*(t_ddMC_end.tv_usec - t_ddMC_start.tv_usec)); 954 #endif 928 955 /* We loop through each row of P normalize it by making all 929 956 * entries integer ones and add the resulting vector to the … … 943 970 } 944 971 intvec *n = new intvec(this->numVars); 972 #ifdef gfanp 973 timeval t_mI_start, t_mI_end; 974 gettimeofday(&t_mI_start,0); 975 #endif 945 976 makeInt(P,jj,*n); 977 #ifdef gfanp 978 gettimeofday(&t_mI_end,0); 979 t_mI += (t_mI_end.tv_sec - t_mI_start.tv_sec + 1e-6*(t_mI_end.tv_usec - t_mI_start.tv_usec)); 980 #endif 946 981 codim2Act->setFacetNormal(n); 947 982 delete n; … … 960 995 dd_set_si(shiftMatrix->matrix[kk][kk+1],1); 961 996 } 962 intPointMatrix=dd_MatrixAppend(ddakt,shiftMatrix); 997 intPointMatrix=dd_MatrixAppend(ddakt,shiftMatrix); 998 #ifdef gfanp 999 timeval t_iP_start, t_iP_end; 1000 gettimeofday(&t_iP_start, 0); 1001 #endif 963 1002 interiorPoint(intPointMatrix,*iv_intPoint); 1003 #ifdef gfanp 1004 gettimeofday(&t_iP_end, 0); 1005 t_iP += (t_iP_end.tv_sec - t_iP_start.tv_sec + 1e-6*(t_iP_end.tv_usec - t_iP_start.tv_usec)); 1006 #endif 964 1007 for(int ll=0;ll<this->numVars;ll++) 965 1008 { … … 973 1016 fAct = fAct->next; 974 1017 dd_FreeMatrix(ddakt); 975 // dd_FreeMatrix(ddineq);976 1018 dd_FreeMatrix(shiftMatrix); 977 dd_FreeMatrix(intPointMatrix); 978 dd_FreePolyhedra(ddpolyh); 1019 dd_FreeMatrix(intPointMatrix); 979 1020 delete iv_intPoint; 980 1021 dd_FreeMatrix(P); 981 1022 set_free(impl_linset); 982 set_free(redset); 1023 set_free(redset); 983 1024 free(newpos); 984 }//for 1025 // set_free(LL); 1026 }//for 985 1027 dd_FreeMatrix(ddineq); 986 // dd_FreeMatrix(P); 987 // set_free(impl_linset); 988 // set_free(redset); 989 // free(newpos); 990 1028 #ifdef gfanp 1029 gettimeofday(&end, 0); 1030 time_getCodim2Normals += (end.tv_sec - start.tv_sec + 1e-6*(end.tv_usec - start.tv_usec)); 1031 #endif 991 1032 } 992 1033 … … 1005 1046 */ 1006 1047 inline void gcone::flip(ideal gb, facet *f) //Compute "the other side" 1007 { 1048 { 1049 #ifdef gfanp 1050 timeval start, end; 1051 gettimeofday(&start, 0); 1052 #endif 1008 1053 intvec *fNormal;// = new intvec(this->numVars); //facet normal, check for parallelity 1009 1054 fNormal = f->getFacetNormal(); //read this->fNormal; … … 1072 1117 idDelete(&initialForm); 1073 1118 ideal H; 1074 // H=kStd(ina,NULL,isHomog,NULL); //we know it is homogeneous1119 // H=kStd(ina,NULL,isHomog,NULL); //we know it is homogeneous 1075 1120 H=kStd(ina,NULL,testHomog,NULL); //This is \mathcal(G)_{>_-\alpha}(in_v(I)) 1076 1121 idSkipZeroes(H); … … 1146 1191 omFree(dst_ExpV); 1147 1192 }//for (int jj=0;jj<IDELEMS(H);jj++) 1148 1149 int *v=(int *)omAlloc((this->numVars+1)*sizeof(int)); 1193 1150 1194 int *leadExpV=(int *)omAlloc((this->numVars+1)*sizeof(int)); 1151 1195 if (markingsAreCorrect==TRUE) … … 1162 1206 while (pNext(aktpoly)!=NULL) 1163 1207 { 1208 int *v=(int *)omAlloc((this->numVars+1)*sizeof(int)); 1164 1209 /*The following if-else-block makes sure the first term (i.e. the wrongly marked term) 1165 1210 is not omitted when computing the differences*/ … … 1181 1226 } 1182 1227 aktrow +=1; 1228 omFree(v); 1183 1229 } 1184 omFree(v);1230 // omFree(v); 1185 1231 omFree(leadExpV); 1186 1232 }//for (int ii=0;ii<IDELEMS(srcRing_HH);ii++) … … 1244 1290 idDelete(&tmpI); 1245 1291 idNorm(dstRing_I); 1246 //kInterRed(dstRing_I);1292 // kInterRed(dstRing_I); 1247 1293 idSkipZeroes(dstRing_I); 1248 1294 test=save; … … 1259 1305 rChangeCurrRing(srcRing); //return to the ring we started the computation of flipGB in 1260 1306 rDelete(dstRing); 1307 #ifdef gfanp 1308 gettimeofday(&end, 0); 1309 time_flip += (end.tv_sec - start.tv_sec + 1e-6*(end.tv_usec - start.tv_usec)); 1310 #endif 1261 1311 }//void flip(ideal gb, facet *f) 1262 1312 … … 1268 1318 inline void gcone::computeInv(ideal &gb, ideal &initialForm, intvec &fNormal) 1269 1319 { 1270 intvec *check = new intvec(this->numVars); 1271 poly initialFormElement;//[IDELEMS(gb)];1272 // poly aktpoly;1273 1320 #ifdef gfanp 1321 timeval start, end; 1322 gettimeofday(&start, 0); 1323 #endif 1274 1324 for (int ii=0;ii<IDELEMS(gb);ii++) 1275 1325 { 1276 // aktpoly = pCopy((poly)gb->m[ii]);1326 poly initialFormElement; 1277 1327 poly aktpoly = (poly)gb->m[ii];//Ptr, so don't pDelete(aktpoly) 1278 int *v=(int *)omAlloc((this->numVars+1)*sizeof(int));1279 1328 int *leadExpV=(int *)omAlloc((this->numVars+1)*sizeof(int)); 1280 1329 pGetExpV(aktpoly,leadExpV); //find the leading exponent in leadExpV[1],...,leadExpV[n], use pNext(p) 1281 1330 // initialFormElement[ii]=pHead(aktpoly); 1282 1331 initialFormElement=pHead(aktpoly); 1283 1284 1332 while(pNext(aktpoly)!=NULL) /*loop trough terms and check for parallelity*/ 1285 1333 { 1334 intvec *check = new intvec(this->numVars); 1286 1335 aktpoly=pNext(aktpoly); //next term 1287 1336 // pSetm(aktpoly); 1337 int *v=(int *)omAlloc((this->numVars+1)*sizeof(int)); 1288 1338 pGetExpV(aktpoly,v); 1289 1339 /* Convert (int)v into (intvec)check */ 1290 1340 for (int jj=0;jj<this->numVars;jj++) 1291 1341 { 1292 //cout << "v["<<jj+1<<"]="<<v[jj+1]<<endl;1293 //cout << "leadExpV["<<jj+1<<"]="<<leadExpV[jj+1]<<endl;1294 1342 (*check)[jj]=v[jj+1]-leadExpV[jj+1]; 1295 1343 } … … 1299 1347 // initialFormElement[ii] = pAdd(pCopy(initialFormElement[ii]),(poly)pHead(aktpoly)); 1300 1348 initialFormElement = pAdd((initialFormElement),(poly)pHead(aktpoly)); 1301 } 1349 } 1350 omFree(v); 1351 delete check; 1302 1352 }//while 1303 1353 #ifdef gfan_DEBUG … … 1312 1362 pDelete(&initialFormElement); 1313 1363 omFree(leadExpV); 1314 omFree(v); 1364 // delete check; 1315 1365 }//for 1316 delete check; 1317 // pDelete(&aktpoly); 1366 #ifdef gfanp 1367 gettimeofday(&end, 0); 1368 time_computeInv += (end.tv_sec - start.tv_sec + 1e-6*(end.tv_usec - start.tv_usec)); 1369 #endif 1318 1370 } 1319 1371 … … 1337 1389 int size=IDELEMS(H); 1338 1390 ideal res=idInit(size,1); 1339 poly temp1;//=pInit();1340 poly temp2;//=pInit();1341 poly temp3;//=pInit(); //polys to temporarily store values for pSub1391 // poly temp1;//=pInit(); 1392 // poly temp2;//=pInit(); 1393 // poly temp3;//=pInit(); //polys to temporarily store values for pSub 1342 1394 for (int ii=0;ii<size;ii++) 1343 1395 { 1396 poly temp1=pInit(); 1397 poly temp2=pInit(); 1398 poly temp3=pInit(); 1344 1399 // res->m[ii]=restOfDiv(H->m[ii],G); 1345 1400 // res->m[ii]=pCopy(kNF(G, NULL,H->m[ii],0,0)); 1346 1401 temp1=pCopy(H->m[ii]); 1347 1402 // temp2=pCopy(res->m[ii]); 1403 //NOTE if gfanHeuristic=0 (sic!) this results in dPolyErrors - mon from wrong ring 1348 1404 temp2=pCopy(kNF(G, NULL,H->m[ii],0,0)); 1349 1405 temp3=pSub(temp1, temp2); 1350 1406 res->m[ii]=pCopy(temp3); 1351 //res->m[ii]=pSub(temp1,temp2); //buggy 1352 //pSort(res->m[ii]); 1353 //pSetm(res->m[ii]); 1354 //cout << "res->m["<<ii<<"]=";pWrite(res->m[ii]); 1355 } 1356 pDelete(&temp1); 1357 // pDelete(&temp2); 1358 // pDelete(&temp3); 1407 //res->m[ii]=pSub(temp1,temp2); //buggy 1408 //cout << "res->m["<<ii<<"]=";pWrite(res->m[ii]); 1409 pDelete(&temp1); 1410 // pDelete(&temp2); 1411 // pDelete(&temp3); //NOTE does not work, so commented out 1412 } 1359 1413 return res; 1360 1414 } … … 1437 1491 dd_LPSolutionPtr lpSol=NULL; 1438 1492 dd_rowset ddlinset,ddredrows; //needed for dd_FindRelativeInterior 1439 dd_rowindex ddnewpos;1493 // dd_rowindex ddnewpos; 1440 1494 dd_NumberType numb; 1441 1495 //M->representation=dd_Inequality; … … 1525 1579 dd_FreeLPData(lp); 1526 1580 set_free(ddlinset); 1527 set_free(ddredrows); 1528 // free(ddnewpos); //segfaults 1581 set_free(ddredrows); 1529 1582 1530 1583 }//void interiorPoint(dd_MatrixPtr const &M) … … 1776 1829 { 1777 1830 gcTmp->writeConeToFile(*gcTmp); 1778 for(int ii=0;ii<IDELEMS(gcTmp->gcBasis);ii++) 1779 { 1780 pDelete(&gcTmp->gcBasis->m[ii]); 1781 } 1782 // idDelete((ideal*)&gcTmp->gcBasis);//Whonder why? 1783 // rDelete(gcTmp->baseRing); 1831 //The for loop is no longer needed 1832 // for(int ii=0;ii<IDELEMS(gcTmp->gcBasis);ii++) 1833 // { 1834 // pDelete(&gcTmp->gcBasis->m[ii]); 1835 // } 1836 idDelete((ideal*)&gcTmp->gcBasis);//Whonder why? 1837 //If you use the following make sure it is uncommented in readConeFromFile 1838 //rDelete(gcTmp->baseRing); 1784 1839 } 1785 //#ifdef gfan_DEBUG1840 #ifdef gfan_DEBUG 1786 1841 // if(SearchListRoot!=NULL) 1787 1842 // gcTmp->showSLA(*SearchListRoot); 1788 //#endif1843 #endif 1789 1844 rChangeCurrRing(gcAct->baseRing); 1790 //rDelete(rTmp);1845 rDelete(rTmp); 1791 1846 //doubly linked for easier removal 1792 1847 gcTmp->prev = gcPtr; … … 1952 2007 facet * gcone::enqueueNewFacets(facet *f) 1953 2008 { 2009 #ifdef gfanp 2010 timeval start, end; 2011 gettimeofday(&start, 0); 2012 #endif 1954 2013 facet *slHead; 1955 2014 slHead = f; … … 2149 2208 fAct = fAct->next; 2150 2209 } 2151 }//while(fAct!=NULL) 2210 }//while(fAct!=NULL) 2211 #ifdef gfanp 2212 gettimeofday(&end, 0); 2213 time_enqueue += (end.tv_sec - start.tv_sec + 1e-6*(end.tv_usec - start.tv_usec)); 2214 #endif 2152 2215 return slHead; 2153 2216 }//addC2N … … 2172 2235 2173 2236 /** \brief Construct a dd_MatrixPtr from a cone's list of facets 2174 * 2237 * NO LONGER USED 2175 2238 */ 2176 2239 inline dd_MatrixPtr gcone::facets2Matrix(const gcone &gc) … … 2201 2264 fAct=fAct->next; 2202 2265 } 2203 2204 2266 return M; 2205 2267 } … … 2316 2378 ss << UCN; 2317 2379 string UCNstr = ss.str(); 2318 string line;2319 string strGcBasisLength;2320 string strMonom, strCoeff, strCoeffNom, strCoeffDenom; 2380 // string line; 2381 // string strGcBasisLength; 2382 // string strMonom, strCoeff, strCoeffNom, strCoeffDenom; 2321 2383 int gcBasisLength=0; 2322 2384 // int intCoeff=1; … … 2324 2386 // int intCoeffDenom=1; 2325 2387 2326 bool hasCoeffInQ = FALSE; //does the polynomial have rational coeff?2327 bool hasNegCoeff = FALSE; //or a negative one?2388 // bool hasCoeffInQ = FALSE; //does the polynomial have rational coeff? 2389 // bool hasNegCoeff = FALSE; //or a negative one? 2328 2390 size_t found; //used for find_first_(not)_of 2329 2391 … … 2340 2402 //Comment the following if you uncomment the if(line=="RING") part below 2341 2403 rChangeCurrRing(gc->baseRing); 2342 // string::iterator EOL;2343 // int terms=1; //#Terms in the poly2344 2404 2345 2405 while( !gcInputFile.eof() ) 2346 2406 { 2407 string line; 2347 2408 getline(gcInputFile,line); 2348 hasCoeffInQ = FALSE;2349 hasNegCoeff = FALSE;2409 // hasCoeffInQ = FALSE; 2410 // hasNegCoeff = FALSE; 2350 2411 2351 2412 if(line=="RING") 2352 { 2353 //getline(gcInputFile,line);2354 //found = line.find("a(");2355 //line.erase(0,found+2);2356 //string strweight;2357 //strweight=line.substr(0,line.find_first_of(")"));2358 //intvec *iv=new intvec(this->numVars);2359 //for(int ii=0;ii<this->numVars;ii++)2360 //{2361 //string weight;2362 //weight=line.substr(0,line.find_first_of(",)"));2363 //(*iv)[ii]=atoi(weight.c_str());2364 //line.erase(0,line.find_first_of(",)")+1);2365 //}2366 //ring newRing;2367 //if(currRing->order[0]!=ringorder_a)2368 //{2369 //newRing=rCopyAndAddWeight(currRing,iv);2370 //}2371 //else2372 //{2373 //newRing=rCopy0(currRing);2374 //int length=this->numVars;2375 //int *A=(int *)omAlloc0(length*sizeof(int));2376 //for(int jj=0;jj<length;jj++)2377 //{2378 //A[jj]=-(*iv)[jj];2379 //}2380 //omFree(newRing->wvhdl[0]);2381 //newRing->wvhdl[0]=(int*)A;2382 //newRing->block1[0]=length;2383 //}2384 //delete iv;2385 //rComplete(newRing);2386 //gc->baseRing=rCopy(newRing);2387 //if(currRing!=gc->baseRing)2388 // rChangeCurrRing(gc->baseRing); 2413 {/* 2414 getline(gcInputFile,line); 2415 found = line.find("a("); 2416 line.erase(0,found+2); 2417 string strweight; 2418 strweight=line.substr(0,line.find_first_of(")")); 2419 intvec *iv=new intvec(this->numVars); 2420 for(int ii=0;ii<this->numVars;ii++) 2421 { 2422 string weight; 2423 weight=line.substr(0,line.find_first_of(",)")); 2424 (*iv)[ii]=atoi(weight.c_str()); 2425 line.erase(0,line.find_first_of(",)")+1); 2426 } 2427 ring newRing; 2428 if(currRing->order[0]!=ringorder_a) 2429 { 2430 newRing=rCopyAndAddWeight(currRing,iv); 2431 } 2432 else 2433 { 2434 newRing=rCopy0(currRing); 2435 int length=this->numVars; 2436 int *A=(int *)omAlloc0(length*sizeof(int)); 2437 for(int jj=0;jj<length;jj++) 2438 { 2439 A[jj]=-(*iv)[jj]; 2440 } 2441 omFree(newRing->wvhdl[0]); 2442 newRing->wvhdl[0]=(int*)A; 2443 newRing->block1[0]=length; 2444 } 2445 delete iv; 2446 rComplete(newRing); 2447 gc->baseRing=rCopy(newRing); 2448 if(currRing!=gc->baseRing) 2449 rChangeCurrRing(gc->baseRing);*/ 2389 2450 } 2390 2451 2391 2452 if(line=="GCBASISLENGTH") 2392 2453 { 2454 string strGcBasisLength; 2393 2455 getline(gcInputFile, line); 2394 2456 strGcBasisLength = line; … … 2399 2461 if(line=="GCBASIS") 2400 2462 { 2401 number nCoeff=nInit(1);2402 number nCoeffNom=nInit(1);2403 number nCoeffDenom=nInit(1);2404 2463 for(int jj=0;jj<gcBasisLength;jj++) 2405 2464 { … … 2408 2467 //polys.cc:p_Read 2409 2468 //check until first occurance of + or - 2410 //data or c_str 2411 poly strPoly=pInit(); 2412 poly resPoly=pInit(); //The poly to be read in 2469 //data or c_str 2470 poly strPoly=pInit();//Ought to be inside the while loop, but that will eat your memory 2471 poly resPoly=pInit(); //The poly to be read in 2413 2472 while(!line.empty()) 2414 2473 { 2415 hasNegCoeff = FALSE; 2416 hasCoeffInQ = FALSE; 2474 // poly strPoly=pInit(); 2475 number nCoeff=nInit(1); 2476 number nCoeffNom=nInit(1); 2477 number nCoeffDenom=nInit(1); 2478 string strMonom, strCoeff, strCoeffNom, strCoeffDenom; 2479 bool hasCoeffInQ = FALSE; //does the polynomial have rational coeff? 2480 bool hasNegCoeff = FALSE; //or a negative one? 2417 2481 found = line.find_first_of("+-"); //get the first monomial 2418 2482 string tmp; … … 2457 2521 const char* monom = strMonom.c_str(); 2458 2522 2459 p_Read(monom,strPoly,currRing); 2523 p_Read(monom,strPoly,currRing); //strPoly:=monom 2460 2524 switch (hasCoeffInQ) 2461 2525 { … … 2463 2527 if(hasNegCoeff) 2464 2528 nCoeffNom=nNeg(nCoeffNom); 2465 // intCoeffNom *= -1;2466 // pSetCoeff(strPoly, nDiv((number)intCoeffNom, (number)intCoeffDenom));2467 2529 pSetCoeff(strPoly, nDiv(nCoeffNom, nCoeffDenom)); 2468 2530 break; 2469 2531 case FALSE: 2470 2532 if(hasNegCoeff) 2471 nCoeff=nNeg(nCoeff); 2472 // intCoeff *= -1; 2533 nCoeff=nNeg(nCoeff); 2473 2534 if(!nIsOne(nCoeff)) 2474 2535 { … … 2485 2546 resPoly=pCopy(strPoly); 2486 2547 else 2487 resPoly=pAdd(resPoly,strPoly); 2548 resPoly=pAdd(resPoly,strPoly); 2549 nDelete(&nCoeff); 2550 nDelete(&nCoeffNom); 2551 nDelete(&nCoeffDenom); 2552 // pDelete(&strPoly); 2488 2553 }//while(!line.empty()) 2489 2554 gc->gcBasis->m[jj]=pCopy(resPoly); 2490 2555 pDelete(&resPoly); //reset 2491 // pDelete(&strPoly); //NOTE Crashes 2492 } 2493 nDelete(&nCoeff); 2494 nDelete(&nCoeffNom); 2495 nDelete(&nCoeffDenom); 2556 // pDelete(&strPoly); //NOTE Crashes 2557 } 2496 2558 break; 2497 2559 }//if(line=="GCBASIS") … … 2532 2594 * set to (poly)NULL in noRevS we need to get this back here. 2533 2595 */ 2534 if(gcAct->gcBasis->m[0]==(poly)NULL) 2596 // if(gcAct->gcBasis->m[0]==(poly)NULL) 2597 if(gfanHeuristic==1) 2535 2598 gcAct->readConeFromFile(gcAct->getUCN(),gcAct); 2536 2599 // ring saveRing=currRing; … … 2577 2640 { 2578 2641 facet *fAct; 2579 intvec *res=new intvec(this->numVars); 2580 intvec *fNormal; 2642 intvec *res;//=new intvec(this->numVars); 2581 2643 // int codim=n; 2582 2644 // int bound; … … 2602 2664 while(fAct!=NULL )//&& ii < bound ) 2603 2665 { 2666 intvec *fNormal; 2604 2667 fNormal = fAct->getFacetNormal(); 2605 2668 for(int jj=0;jj<this->numVars;jj++) … … 2609 2672 } 2610 2673 fAct = fAct->next; 2611 }2612 delete fNormal;2674 delete fNormal; 2675 } 2613 2676 return *res; 2614 2677 } … … 2616 2679 int gcone::counter=0; 2617 2680 int gfanHeuristic; 2681 #ifdef gfanp 2682 float gcone::time_getConeNormals; 2683 float gcone::time_getCodim2Normals; 2684 float gcone::time_flip; 2685 float gcone::time_enqueue; 2686 float gcone::time_computeInv; 2687 float gcone::t_ddMC; 2688 float gcone::t_mI; 2689 float gcone::t_iP; 2690 #endif 2618 2691 // ideal gfan(ideal inputIdeal, int h) 2619 2692 lists gfan(ideal inputIdeal, int h) … … 2691 2764 //gcone::counter=0; 2692 2765 /*Return result*/ 2766 #ifdef gfanp 2767 cout << "t_getConeNormals:" << gcone::time_getConeNormals << endl; 2768 cout << "t_getCodim2Normals:" << gcone::time_getCodim2Normals << endl; 2769 cout << " t_ddMC:" << gcone::t_ddMC << endl; 2770 cout << " t_mI:" << gcone::t_mI << endl; 2771 cout << " t_iP:" << gcone::t_iP << endl; 2772 cout << "t_Flip:" << gcone::time_flip << endl; 2773 cout << "t_computeInv:" << gcone::time_computeInv << endl; 2774 cout << "t_enqueue:" << gcone::time_enqueue << endl; 2775 #endif 2693 2776 return lResList; 2694 2777 } -
kernel/gfan.h
r44b47d r42660f 21 21 #endif 22 22 extern int gfanHeuristic; 23 #define gfanp 24 // #ifdef gfanp 25 // extern static float time_getConeNormals; 26 // extern static float time_getCodim2Normals; 27 // extern static float time_flip; 28 // extern static float time_enqueue; 29 // extern static float time_computeInv; 30 // #endif 23 31 //ideal getGB(ideal inputIdeal); 24 32 // ideal gfan(ideal inputIdeal, int heuristic); … … 105 113 */ 106 114 inline void fDebugPrint(); 107 108 115 friend class gcone; 109 116 }; … … 130 137 /** \brief Pointer to the first facet */ 131 138 facet *facetPtr; //Will hold the adress of the first facet; set by gcone::getConeNormals 132 139 #ifdef gfanp 140 static float time_getConeNormals; 141 static float time_getCodim2Normals; 142 static float time_flip; 143 static float time_enqueue; 144 static float time_computeInv; 145 static float t_ddMC; 146 static float t_mI; 147 static float t_iP; 148 #endif 149 133 150 /** # of variables in the ring */ 134 151 int numVars; //#of variables in the ring
Note: See TracChangeset
for help on using the changeset viewer.