Changeset 7fee4f6 in git
 Timestamp:
 Jun 14, 2009, 12:00:14 PM (14 years ago)
 Branches:
 (u'jengelhdatetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '00e2e9c41af3fde1273eb3633f4c0c7c3db2579d')
 Children:
 e28cf1ea73e36a7c3768b1ea8eb0e279b22ecede
 Parents:
 9918fd329f6178bcb0152873e21d810764461b77
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

kernel/gfan.cc
r9918fd r7fee4f6 2 2 Compute the Groebner fan of an ideal 3 3 $Author: monerjan $ 4 $Date: 2009061 2 16:32:00$5 $Header: /exports/cvsroot2/cvsroot/kernel/gfan.cc,v 1. 59 20090612 16:32:00monerjan Exp $6 $Id: gfan.cc,v 1. 59 20090612 16:32:00monerjan Exp $4 $Date: 20090614 10:00:14 $ 5 $Header: /exports/cvsroot2/cvsroot/kernel/gfan.cc,v 1.60 20090614 10:00:14 monerjan Exp $ 6 $Id: gfan.cc,v 1.60 20090614 10:00:14 monerjan Exp $ 7 7 */ 8 8 … … 940 940 turn the minimal basis into a reduced one 941 941 */ 942 int i,j; 943 ring dstRing=rCopy0(srcRing); 944 i=rBlocks(srcRing); 945 946 dstRing>order=(int *)omAlloc((i+1)*sizeof(int)); 947 for(j=i;j>0;j) 948 { 949 dstRing>order[j]=srcRing>order[j1]; 950 dstRing>block0[j]=srcRing>block0[j1]; 951 dstRing>block1[j]=srcRing>block1[j1]; 952 if (srcRing>wvhdl[j1] != NULL) 953 { 954 dstRing>wvhdl[j] = (int*) omMemDup(srcRing>wvhdl[j1]); 955 } 956 } 957 dstRing>order[0]=ringorder_a; 958 dstRing>order[1]=ringorder_dp; 959 dstRing>order[2]=ringorder_C; 960 dstRing>wvhdl[0] =( int *)omAlloc((iv_weight>length())*sizeof(int)); 961 962 for (int ii=0;ii<this>numVars;ii++) 963 { 964 dstRing>wvhdl[0][ii]=(*iv_weight)[ii]; 965 } 966 rComplete(dstRing); 942 ring dstRing=rCopyAndAddWeight(tmpRing,iv_weight); 943 944 // int i,j; 945 // ring dstRing=rCopy0(srcRing); 946 // i=rBlocks(srcRing); 947 // 948 // dstRing>order=(int *)omAlloc((i+1)*sizeof(int)); 949 // for(j=i;j>0;j) 950 // { 951 // dstRing>order[j]=srcRing>order[j1]; 952 // dstRing>block0[j]=srcRing>block0[j1]; 953 // dstRing>block1[j]=srcRing>block1[j1]; 954 // if (srcRing>wvhdl[j1] != NULL) 955 // { 956 // dstRing>wvhdl[j] = (int*) omMemDup(srcRing>wvhdl[j1]); 957 // } 958 // } 959 // dstRing>order[0]=ringorder_a; 960 // dstRing>order[1]=ringorder_dp; 961 // dstRing>order[2]=ringorder_C; 962 // dstRing>wvhdl[0] =( int *)omAlloc((iv_weight>length())*sizeof(int)); 963 // 964 // for (int ii=0;ii<this>numVars;ii++) 965 // { 966 // dstRing>wvhdl[0][ii]=(*iv_weight)[ii]; 967 // } 968 // rComplete(dstRing); 967 969 968 970 // NOTE May assume that at this point srcRing already has 3 blocks of orderins, starting with a … … 1000 1002 f>printFlipGB(); 1001 1003 #endif 1002 rChangeCurrRing(srcRing); //return to the ring we started the computation of flipGB in1004 //rChangeCurrRing(srcRing); //return to the ring we started the computation of flipGB in 1003 1005 }//void flip(ideal gb, facet *f) 1004 1006 … … 1212 1214 //dd_LPSolve(lpInt,solver,&err); //This will not result in a point from the relative interior 1213 1215 if (err!=dd_NoError){cout << "Error during dd_LPSolve" << endl;} 1214 //cout << "Tick 5" << endl;1215 1216 1216 1217 //lpSol=dd_CopyLPSolution(lpInt); 1217 1218 if (err!=dd_NoError){cout << "Error during dd_CopyLPSolution" << endl;} 1218 //cout << "Tick 6" << endl;1219 1219 #ifdef gfan_DEBUG 1220 1220 cout << "Interior point: "; 1221 #endif1222 1221 for (int ii=1; ii<(lpSol>d)1;ii++) 1223 1222 { 1224 #ifdef gfan_DEBUG1225 1223 dd_WriteNumber(stdout,lpSol>sol[ii]); 1226 #endif 1227 /* NOTE This works only as long as gmp returns fractions with the same denominator*/ 1228 (iv)[ii1]=(int)mpz_get_d(mpq_numref(lpSol>sol[ii])); //looks evil, but does the trick 1229 } 1224 } 1225 #endif 1226 1227 //NOTE The following strongly resembles parts of makeInt. 1228 //Maybe merge sometimes 1229 mpz_t kgV; mpz_init(kgV); 1230 mpz_set_str(kgV,"1",10); 1231 mpz_t den; mpz_init(den); 1232 mpz_t tmp; mpz_init(tmp); 1233 mpq_get_den(tmp,lpSol>sol[1]); 1234 for (int ii=1;ii<(lpSol>d)1;ii++) 1235 { 1236 mpq_get_den(den,lpSol>sol[ii+1]); 1237 mpz_lcm(kgV,tmp,den); 1238 mpz_set(tmp, kgV); 1239 } 1240 mpq_t qkgV; 1241 mpq_init(qkgV); 1242 mpq_set_z(qkgV,kgV); 1243 for (int ii=1;ii<(lpSol>d)1;ii++) 1244 { 1245 mpq_t product; 1246 mpq_init(product); 1247 mpq_mul(product,qkgV,lpSol>sol[ii]); 1248 iv[ii1]=(int)mpz_get_d(mpq_numref(product)); 1249 mpq_clear(product); 1250 } 1251 mpq_clear(qkgV); 1252 mpz_clear(tmp); 1253 mpz_clear(den); 1254 mpz_clear(kgV); 1255 1230 1256 dd_FreeLPSolution(lpSol); 1231 1257 dd_FreeLPData(lpInt);
Note: See TracChangeset
for help on using the changeset viewer.