Changeset c4d065 in git
- Timestamp:
- Nov 26, 2010, 4:37:58 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 92e2cd1822dc1be6a8ef69173615a30e5bd67d0e
- Parents:
- 9e7d85ecc0703de24759963ee74edd60d4139c09
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/iparith.cc
r9e7d85 rc4d065 3475 3475 return FALSE; 3476 3476 }*/ 3477 static BOOLEAN jjINSERTCONE(leftv res, leftv u, leftv v) 3478 { 3479 gfan::ZFan* zf = (gfan::ZFan*)u->Data(); 3480 gfan::ZCone* zc = (gfan::ZCone*)v->Data(); 3481 zf->insert(*zc); 3482 return FALSE; 3483 } 3477 3484 static BOOLEAN jjGETPROPC(leftv res, leftv u, leftv v) 3478 3485 { … … 5025 5032 case RESOLUTION_CMD: res->data=omStrDup("resolution");break; 5026 5033 #ifdef HAVE_FANS 5027 //case FAN_CMD: res->data=omStrDup("fan");break;5034 case FAN_CMD: res->data=omStrDup("fan");break; 5028 5035 case CONE_CMD: res->data=omStrDup("cone");break; 5029 5036 #endif /* HAVE_FANS */ … … 5087 5094 return FALSE; 5088 5095 } 5089 5090 5096 BOOLEAN jjWAITALL1(leftv res, leftv a) 5091 5097 { … … 5104 5110 return FALSE; 5105 5111 } 5106 5107 5112 #ifdef HAVE_FANS 5113 static BOOLEAN jjFANEMPTY_I(leftv res, leftv v) 5114 { 5115 int ambientDim = (int)(long)v->Data(); 5116 if (ambientDim < 0) 5117 { 5118 Werror("expected non-negative ambient dim but got %d", ambientDim); 5119 return TRUE; 5120 } 5121 res->data = (char*)(new gfan::ZFan(ambientDim)); 5122 return FALSE; 5123 } 5124 static BOOLEAN jjFANEMPTY_IM(leftv res, leftv v) 5125 { 5126 intvec* permutations = (intvec*)v->Data(); 5127 // todo: check that permutations contains sensible elements of S_n 5128 int ambientDim = permutations->cols(); 5129 gfan::SymmetryGroup sg = gfan::SymmetryGroup(ambientDim); 5130 gfan::ZMatrix zm = intmat2ZMatrix(permutations); 5131 gfan::IntMatrix im = gfan::ZToIntMatrix(zm); 5132 sg.computeClosure(im); 5133 res->data = (char*)(new gfan::ZFan(sg)); 5134 return FALSE; 5135 } 5136 static BOOLEAN jjFANFULL_I(leftv res, leftv v) 5137 { 5138 int ambientDim = (int)(long)v->Data(); 5139 if (ambientDim < 0) 5140 { 5141 Werror("expected non-negative ambient dim but got %d", ambientDim); 5142 return TRUE; 5143 } 5144 gfan::ZFan* zf = new gfan::ZFan(gfan::ZFan::fullFan(ambientDim)); 5145 res->data = (char*)zf; 5146 return FALSE; 5147 } 5148 static BOOLEAN jjFANFULL_IM(leftv res, leftv v) 5149 { 5150 intvec* permutations = (intvec*)v->Data(); 5151 // todo: check that permutations contains sensible elements of S_n 5152 int ambientDim = permutations->cols(); 5153 gfan::SymmetryGroup sg = gfan::SymmetryGroup(ambientDim); 5154 gfan::ZMatrix zm = intmat2ZMatrix(permutations); 5155 gfan::IntMatrix im = gfan::ZToIntMatrix(zm); 5156 sg.computeClosure(im); 5157 gfan::ZFan* zf = new gfan::ZFan(gfan::ZFan::fullFan(sg)); 5158 res->data = (char*)zf; 5159 return FALSE; 5160 } 5108 5161 static BOOLEAN jjCONERAYS1(leftv res, leftv v) 5109 5162 { -
Singular/ipassign.cc
r9e7d85 rc4d065 324 324 } 325 325 #ifdef HAVE_FANS 326 /*327 326 static BOOLEAN jiA_FAN(leftv res, leftv a, Subexpr e) 328 327 { … … 334 333 if (res->data!=NULL) 335 334 { 336 Fan* fff = (Fan*)res->data;335 gfan::ZFan* zf = (gfan::ZFan*)res->data; 337 336 res->data = NULL; 338 delete fff;339 } 340 Fan* fff = (Fan*)a->CopyD(FAN_CMD);341 res->data=(void*) fff;342 return FALSE; 343 } */337 delete zf; 338 } 339 gfan::ZFan* zf = (gfan::ZFan*)a->CopyD(FAN_CMD); 340 res->data=(void*)zf; 341 return FALSE; 342 } 344 343 static BOOLEAN jiA_CONE(leftv res, leftv a, Subexpr e) 345 344 { … … 1339 1338 } 1340 1339 #ifdef HAVE_FANS 1341 /*1342 1340 BOOLEAN jjAssignFan(leftv l, leftv r) 1343 { */1341 { 1344 1342 /* method for generating a fan; 1345 valid parametrizations: (intmat or 0, intmat or 0, intmat or 0), 1346 The intmat's capture the maximal rays, facet normals and the 1347 lineality space of the new fan. 1348 Any of the arguments may be the int 0. But either the 1st or 1349 2nd argument must be an intmat, thus not both simultaneously 1350 the int 0. 1343 valid parametrizations: int (ambient dimension), 1351 1344 Errors will be invoked in the following cases: 1352 - 1st and 2nd argument simultaneously the int 0, 1353 - numbers of rows in 1st, 2nd, and/or 3rd argument intmat 1354 disagree */ 1355 // intvec* maxRays = NULL; /* maximal rays */ 1356 // intvec* facetNs = NULL; /* facet normals */ 1357 // intvec* linSpace = NULL; /* lineality space */ 1358 /* 1359 leftv x = r; 1360 if (x->Typ() == INTMAT_CMD) maxRays = (intvec*)x->Data(); 1361 else if ((x->Typ() != INT_CMD) || 1362 ((x->Typ() == INT_CMD) && ((int)(long)x->Data() != 0))) 1363 { 1364 WerrorS("expected '0' or an intmat as 1st argument"); 1345 - argument < 0 1346 The resulting fan has no cones, its lineality space 1347 is the entire ambient space. */ 1348 if (r->Typ() != INT_CMD) 1349 { 1350 WerrorS("expected an int as argument"); 1365 1351 return TRUE; 1366 1352 } 1367 x = x->next; 1368 if (x->Typ() == INTMAT_CMD) facetNs = (intvec*)x->Data(); 1369 else if ((x->Typ() != INT_CMD) || 1370 ((x->Typ() == INT_CMD) && ((int)(long)x->Data() != 0))) 1371 { 1372 WerrorS("expected '0' or an intmat as 2nd argument"); 1353 int ambientDim = (int)(long)r->Data(); 1354 if (ambientDim < 0) 1355 { 1356 Werror("expected an int >= 0, but got %d", ambientDim); 1373 1357 return TRUE; 1374 1358 } 1375 if ((maxRays == NULL) && (facetNs == NULL))1376 {1377 WerrorS("expected 1st or 2nd argument to be a valid intmat");1378 return TRUE;1379 }1380 x = x->next;1381 if (x->Typ() == INTMAT_CMD) linSpace = (intvec*)x->Data();1382 else if ((x->Typ() != INT_CMD) ||1383 ((x->Typ() == INT_CMD) && ((int)(long)x->Data() != 0)))1384 {1385 WerrorS("expected '0' or an intmat as 3rd argument");1386 return TRUE;1387 }1388 if ((maxRays != NULL) && (facetNs != NULL) &&1389 (maxRays->rows() != facetNs->rows()))1390 {1391 WerrorS("vector space dims do not agree (1st vs. 2nd argument)");1392 return TRUE;1393 }1394 if ((maxRays != NULL) && (linSpace != NULL) &&1395 (maxRays->rows() != linSpace->rows()))1396 {1397 WerrorS("vector space dims do not agree (1st vs. 3rd argument)");1398 return TRUE;1399 }1400 1401 1359 if (IDDATA((idhdl)l->data) != NULL) 1402 1360 { 1403 Fan* fff = (Fan*)IDDATA((idhdl)l->data);1404 delete fff;1405 } 1406 Fan* fff = new Fan(maxRays, facetNs, linSpace);1407 IDDATA((idhdl)l->data) = (char*) fff;1408 return FALSE; 1409 } */1361 gfan::ZFan* zf = (gfan::ZFan*)IDDATA((idhdl)l->data); 1362 delete zf; 1363 } 1364 gfan::ZFan* zf = new gfan::ZFan(ambientDim); 1365 IDDATA((idhdl)l->data) = (char*)zf; 1366 return FALSE; 1367 } 1410 1368 BOOLEAN jjAssignCone(leftv l, leftv r) 1411 1369 { … … 1498 1456 if ((l->Typ() == CONE_CMD) && (r->Typ() == INT_CMD)) 1499 1457 return jjAssignCone(l, r); 1458 if ((l->Typ() == FAN_CMD) && (r->Typ() == INT_CMD)) 1459 return jjAssignFan(l, r); 1500 1460 #endif 1501 1461 /* system variables = ... */ -
Singular/ipid.cc
r9e7d85 rc4d065 204 204 } 205 205 #ifdef HAVE_FANS 206 /*207 206 else if (t == FAN_CMD) 208 207 { 209 IDSTRING(h) = (char*)(new Fan());210 } */208 IDSTRING(h) = (char*)(new gfan::ZFan(0)); 209 } 211 210 else if (t == CONE_CMD) 212 211 { … … 479 478 #ifdef HAVE_FANS 480 479 // fan ------------------------------------------------------------- 481 /*else if (IDTYP(h) == FAN_CMD)482 { 483 Fan* fff = (Fan*)IDDATA(h);484 delete fff;480 else if (IDTYP(h) == FAN_CMD) 481 { 482 gfan::ZFan* zf = (gfan::ZFan*)IDDATA(h); 483 delete zf; 485 484 IDDATA(h) = NULL; 486 } */485 } 487 486 // cone ------------------------------------------------------------ 488 487 else if (IDTYP(h) == CONE_CMD) -
Singular/subexpr.cc
r9e7d85 rc4d065 127 127 } 128 128 129 /* not used */ 129 130 std::string toPrintString(gfan::ZCone const &c, char *nameOfCone) 130 131 { … … 234 235 #ifdef HAVE_FANS 235 236 case CONE_CMD: 236 //case FAN_CMD:237 case FAN_CMD: 237 238 PrintNSpaces(spaces); 238 239 { … … 576 577 } 577 578 #ifdef HAVE_FANS 578 /*case FAN_CMD:579 { 580 Fan* fff = (Fan*)d;581 Fan* ggg = new Fan(*fff);582 return ggg;583 } */579 case FAN_CMD: 580 { 581 gfan::ZFan* zf = (gfan::ZFan*)d; 582 gfan::ZFan* newZf = new gfan::ZFan(*zf); 583 return newZf; 584 } 584 585 case CONE_CMD: 585 586 { … … 874 875 return s; 875 876 #ifdef HAVE_FANS 876 /*case FAN_CMD:877 { 878 Fan* fff = (Fan*)d;879 s = fff->toString();880 char* ns = (char*) omAlloc(strlen(s ) + 10);881 sprintf(ns, "%s", s );877 case FAN_CMD: 878 { 879 gfan::ZFan* zf = (gfan::ZFan*)d; 880 std::string s = zf->toString(); 881 char* ns = (char*) omAlloc(strlen(s.c_str()) + 10); 882 sprintf(ns, "%s", s.c_str()); 882 883 omCheckAddr(ns); 883 omFree(s);884 884 return ns; 885 } */885 } 886 886 case CONE_CMD: 887 887 { -
Singular/table.h
r9e7d85 rc4d065 291 291 //,{D(jjMAXCONE1), MAXCONE_CMD, LIST_CMD, FAN_CMD , ALLOW_PLURAL |ALLOW_RING} 292 292 //,{D(jjADJACENCY1), ADJACENCY_CMD, INTMAT_CMD, FAN_CMD , ALLOW_PLURAL |ALLOW_RING} 293 ,{D(jjCONERAYS1), CONERAYS_CMD, CONE_CMD, INTMAT_CMD , ALLOW_PLURAL |ALLOW_RING} 294 ,{D(jjCONENORMALS1),CONENORMALS_CMD,CONE_CMD, INTMAT_CMD , ALLOW_PLURAL |ALLOW_RING} 293 ,{D(jjCONERAYS1), CONERAYS_CMD, CONE_CMD, INTMAT_CMD , ALLOW_PLURAL |ALLOW_RING} 294 ,{D(jjCONENORMALS1),CONENORMALS_CMD,CONE_CMD, INTMAT_CMD , ALLOW_PLURAL |ALLOW_RING} 295 ,{D(jjFANEMPTY_I), FANEMPTY_CMD, FAN_CMD, INT_CMD , ALLOW_PLURAL |ALLOW_RING} 296 ,{D(jjFANEMPTY_IM), FANEMPTY_CMD, FAN_CMD, INTMAT_CMD , ALLOW_PLURAL |ALLOW_RING} 297 ,{D(jjFANFULL_I), FANFULL_CMD, FAN_CMD, INT_CMD , ALLOW_PLURAL |ALLOW_RING} 298 ,{D(jjFANFULL_IM), FANFULL_CMD, FAN_CMD, INTMAT_CMD , ALLOW_PLURAL |ALLOW_RING} 295 299 #endif /* HAVE_FANS */ 296 300 ,{NULL, 0, 0, 0 , NO_PLURAL |NO_RING} … … 670 674 ,{D(jjCONTAINS2), CONTAINS_CMD, INT_CMD, CONE_CMD, CONE_CMD, ALLOW_PLURAL |ALLOW_RING} 671 675 ,{D(jjGETPROPC), GETPROP_CMD, ANY_TYPE/*set by p*/,CONE_CMD,STRING_CMD, ALLOW_PLURAL |ALLOW_RING} 676 ,{D(jjINSERTCONE),INSERTCONE_CMD, NONE, FAN_CMD, CONE_CMD, ALLOW_PLURAL | ALLOW_RING} 672 677 //,{D(jjADDMCONE1), ADDMCONE_CMD, NONE, FAN_CMD, CONE_CMD, ALLOW_PLURAL | ALLOW_RING} 673 678 //,{D(jjADDMCONE2), ADDMCONE_CMD, NONE, FAN_CMD, LIST_CMD, ALLOW_PLURAL | ALLOW_RING} … … 874 879 { "cone_via_rays",0, CONERAYS_CMD, CMD_123}, 875 880 { "cone_via_normals",0,CONENORMALS_CMD, CMD_123}, 881 { "fan_empty", 0, FANEMPTY_CMD, CMD_1}, 882 { "fan_full", 0, FANEMPTY_CMD, CMD_1}, 883 { "insert_cone", 0, INSERTCONE_CMD, CMD_2}, 876 884 { "cone_intersect",0,INTERSC_CMD, CMD_2}, 877 885 { "cone_link", 0, CONELINK_CMD, CMD_2}, … … 879 887 { "getprop", 0, GETPROP_CMD, CMD_2}, 880 888 { "setprop", 0, SETPROP_CMD, CMD_3}, 889 { "fan", 0, FAN_CMD, ROOT_DECL}, 881 890 #endif /* HAVE_FANS */ 882 891 { "alias", 0, ALIAS_CMD , PARAMETER}, … … 1239 1248 ,{D(jiA_LINK), LINK_CMD, LINK_CMD } 1240 1249 #ifdef HAVE_FANS 1241 //,{D(jiA_FAN), FAN_CMD, FAN_CMD }1250 ,{D(jiA_FAN), FAN_CMD, FAN_CMD } 1242 1251 ,{D(jiA_CONE), CONE_CMD, CONE_CMD } 1243 1252 #endif /* HAVE_FANS */ -
Singular/tok.h
r9e7d85 rc4d065 54 54 //#ifdef HAVE_FANS 55 55 CONE_CMD, 56 FAN_CMD, 56 57 CONELINK_CMD, 57 58 CONERAYS_CMD, 58 59 CONENORMALS_CMD, 60 FANEMPTY_CMD, 61 FANFULL_CMD, 62 INSERTCONE_CMD, 59 63 CONTAINS_CMD, 60 64 FACECONT_CMD, -
factory/cf_gcd.cc
r9e7d85 rc4d065 22 22 #include "fieldGCD.h" 23 23 #include "cf_gcd_smallp.h" 24 25 24 26 25 #ifdef HAVE_NTL -
gfanlib/gfanlib_matrix.h
r9e7d85 rc4d065 568 568 typedef Matrix<Integer> ZMatrix; 569 569 typedef Matrix<Rational> QMatrix; 570 typedef Matrix<int> IntMatrix; 570 571 571 572 inline QMatrix ZToQMatrix(ZMatrix const &m) … … 580 581 ZMatrix ret(m.getHeight(),m.getWidth()); 581 582 for(int i=0;i<m.getHeight();i++)ret[i]=QToZVectorPrimitive(m[i]); 583 return ret; 584 } 585 586 587 inline IntMatrix ZToIntMatrix(ZMatrix const &m) 588 { 589 IntMatrix ret(m.getHeight(),m.getWidth()); 590 for(int i=0;i<m.getHeight();i++)ret[i]=ZToIntVector(m[i]); 591 return ret; 592 } 593 594 595 inline ZMatrix IntToZMatrix(IntMatrix const &m) 596 { 597 ZMatrix ret(m.getHeight(),m.getWidth()); 598 for(int i=0;i<m.getHeight();i++)ret[i]=IntToZVector(m[i]); 582 599 return ret; 583 600 } -
gfanlib/gfanlib_polymakefile.cpp
r9e7d85 rc4d065 10 10 #include <assert.h> 11 11 #include <sstream> 12 #include <istream> 12 13 13 14 using namespace std; … … 31 32 } 32 33 33 static string readUntil( FILE *f, int c)34 static string readUntil(istream &f, int c) 34 35 { 35 36 stringstream ret; 36 37 int c2; 37 c2=fgetc(f); 38 while(c2!=c && c2!=EOF) 39 { 38 c2=f.get(); 39 // c2=fgetc(f); 40 // while(c2!=c && c2!=EOF) 41 while(c2!=c && !f.eof()) 42 { 40 43 ret<<char(c2); 41 c2=fgetc(f); 42 } 44 //c2=fgetc(f); 45 c2=f.get(); 46 } 43 47 return ret.str(); 44 48 } … … 67 71 68 72 69 void PolymakeFile::open(const char *fileName_) 73 void PolymakeFile::open(std::istream &f) 74 { 75 isXml=false; 76 // fileName=string(fileName_); 77 78 // FILE *f=fopen(fileName.c_str(),"r"); 79 // if(!f)//fprintf(Stderr,"Could not open file:\"%s\"\n",fileName_); 80 // assert(f); 81 82 int c=f.get();//fgetc(f); 83 while(!f.eof()) 84 { 85 if(c=='_') 86 { 87 readUntil(f,'\n'); 88 } 89 else if(c!='\n') 90 { 91 f.unget(); 92 // ungetc(c,f); 93 string name=readUntil(f,'\n'); 94 95 // fprintf(Stderr,"Reading:\"%s\"\n",name.c_str()); 96 stringstream value; 97 while(1) 98 { 99 string l=readUntil(f,'\n'); 100 if(l.size()==0)break; 101 value << l <<endl; 102 } 103 properties.push_back(PolymakeProperty(name.c_str(),value.str().c_str())); 104 } 105 c=f.get();//fgetc(f); 106 } 107 } 108 109 /*void PolymakeFile::open(const char *fileName_) 70 110 { 71 111 isXml=false; … … 101 141 } 102 142 } 103 104 143 */ 105 144 void PolymakeFile::create(const char *fileName_, const char *application_, const char *type_, bool isXml_) 106 145 { … … 244 283 ZMatrix PolymakeFile::readMatrixProperty(const char *p, int height, int width) 245 284 { 246 ZMatrix ret( height,width);285 ZMatrix ret(0,width); 247 286 248 287 assert(hasProperty(p,true)); 249 288 list<PolymakeProperty>::iterator prop=findProperty(p); 250 289 stringstream s(prop->value); 251 for(int i=0;i<height;i++) 290 // for(int i=0;i<height;i++) 291 for(int i=0;;i++) 292 { 293 if(i==height)break; 294 ZVector w(width); 252 295 for(int j=0;j<width;j++) 253 { 254 int v; 255 eatComment(s); 256 s>>v; 257 ret[i][j]=v; 258 } 296 { 297 int v; 298 eatComment(s); 299 s>>v; 300 if(s.eof())goto done; 301 w[j]=v; 302 } 303 ret.appendRow(w); 304 } 305 done: 306 307 if(height>=0)assert(ret.getHeight()==height); 308 // cerr<<p; 309 // eatComment(s); 310 // int v; 311 // s>>v; 312 // while(!s.eof())std::cerr<<char(s.get()); 313 // assert(s.eof()); 259 314 260 315 return ret; -
gfanlib/gfanlib_polymakefile.h
r9e7d85 rc4d065 36 36 bool isXml; 37 37 public: 38 void open(const char *fileName_); 38 // void open(const char *fileName_); 39 void open(std::istream &f); 39 40 void create(const char *fileName_, const char *application_, const char *type_, bool isXml_=false); 40 41 void writeStream(std::ostream &file); -
gfanlib/gfanlib_symmetriccomplex.cpp
r9e7d85 rc4d065 247 247 int dimLow=this->linealitySpace.getHeight(); 248 248 int dimHigh=this->getMaxDim(); 249 if(dimHigh<dimLow)dimHigh=dimLow-1; 249 250 if(conelist)*conelist=std::vector<std::vector<IntVector> >(dimHigh-dimLow+1); 250 251 251 for(int d=dimLow;d<=dimHigh;d++) 252 252 { … … 292 292 } 293 293 } 294 295 294 296 295 } … … 364 363 { 365 364 int min=getMinDim(); 366 ZVector ret(getMaxDim()-min+1); 365 int dimHigh=getMaxDim(); 366 if(dimHigh<min)dimHigh=min-1; 367 ZVector ret(dimHigh-min+1); 367 368 368 369 for(ConeContainer::const_iterator i=cones.begin();i!=cones.end();i++) … … 523 524 524 525 525 polymakeFile.writeMatrixProperty("LINEALITY_SPACE", kernel(linealitySpace),n);526 polymakeFile.writeMatrixProperty("ORTH_LINEALITY_SPACE", linealitySpace,n);526 polymakeFile.writeMatrixProperty("LINEALITY_SPACE",linealitySpace,n); 527 polymakeFile.writeMatrixProperty("ORTH_LINEALITY_SPACE",kernel(linealitySpace),n); 527 528 528 529 /* … … 585 586 polymakeFile.writeCardinalProperty("PURE",isPure()); 586 587 // log1 fprintf(Stderr,"Done checking.\n"); 588 589 590 polymakeFile.writeStringProperty("CONES",toStringJustCones(getMinDim(),getMaxDim(),false,flags&FPF_group, 0,false,flags&FPF_tPlaneSort)); 591 polymakeFile.writeStringProperty("MAXIMAL_CONES",toStringJustCones(getMinDim(),getMaxDim(),true,flags&FPF_group, 0,false,flags&FPF_tPlaneSort)); 592 polymakeFile.writeStringProperty("CONES_ORBITS",toStringJustCones(getMinDim(),getMaxDim(),false,flags&FPF_group, 0,true,flags&FPF_tPlaneSort)); 593 polymakeFile.writeStringProperty("MAXIMAL_CONES_ORBITS",toStringJustCones(getMinDim(),getMaxDim(),true,flags&FPF_group, 0,true,flags&FPF_tPlaneSort)); 594 595 if(!sym.isTrivial()) 596 { 597 polymakeFile.writeMatrixProperty("SYMMETRY_GENERATORS",IntToZMatrix(sym.getGenerators())); 598 } 587 599 588 600 std::stringstream s; -
gfanlib/gfanlib_symmetry.cpp
r9e7d85 rc4d065 212 212 } 213 213 214 IntMatrix SymmetryGroup::getGenerators()const 215 { 216 IntMatrix ret(0,this->sizeOfBaseSet()); 217 for(ElementContainer::const_iterator i=elements.begin();i!=elements.end();i++)ret.appendRow(i->toIntVector()); 218 return ret; 219 } 220 214 221 void SymmetryGroup::computeClosure(Permutation const &v) //does this work?? 215 222 { … … 220 227 while(!newOnes.empty()) 221 228 { 222 static int i;223 i++;224 225 229 Permutation v=*newOnes.begin(); 226 230 for(ElementContainer::const_iterator i=elements.begin();i!=elements.end();i++) … … 232 236 } 233 237 { 234 Permutation n=v.apply( *i);238 Permutation n=v.apply(v); 235 239 if(0==elements.count(n)) 236 240 newOnes.insert(n); … … 243 247 244 248 245 /* 246 247 void SymmetryGroup::computeClosure(IntegerVectorList const &l) 248 { 249 // for(IntegerVectorList::const_iterator i=l.begin();i!=l.end();i++) 250 // computeClosure(*i); 251 252 bool growing=true; 253 while(growing) 254 { 255 growing=false; 256 for(ElementContainer::const_iterator i=elements.begin();i!=elements.end();i++) 257 { 258 for(IntegerVectorList::const_iterator j=l.begin();j!=l.end();j++) 259 { 260 { 261 IntegerVector n(compose(*i,*j)); 262 growing|=(0==elements.count(n)); 263 elements.insert(n); 264 } 265 { 266 IntegerVector n(compose(*i,*j)); 267 growing|=(0==elements.count(n)); 268 elements.insert(n); 269 } 270 } 271 } 272 } 273 } 274 */ 249 void SymmetryGroup::computeClosure(IntMatrix const &l) 250 { 251 for(int i=0;i<l.getHeight();i++)computeClosure(Permutation(l[i])); 252 } 253 275 254 276 255 /* -
gfanlib/gfanlib_symmetry.h
r9e7d85 rc4d065 118 118 SymmetryGroup(int n); 119 119 void computeClosure(Permutation const &v); 120 void computeClosure(ZMatrix const &l); 120 void computeClosure(IntMatrix const &l); 121 IntMatrix getGenerators()const; 121 122 int orbitSize(ZVector const &stable)const; 122 123 bool isTrivial()const; -
gfanlib/gfanlib_vector.h
r9e7d85 rc4d065 313 313 QVector ret(v.size()); 314 314 for(int i=0;i<v.size();i++)ret[i]=Rational(v[i]); 315 return ret; 316 } 317 318 319 inline IntVector ZToIntVector(ZVector const &v) 320 { 321 IntVector ret(v.size()); 322 for(int i=0;i<v.size();i++)ret[i]=v[i].toInt(); 323 return ret; 324 } 325 326 327 inline ZVector IntToZVector(IntVector const &v) 328 { 329 ZVector ret(v.size()); 330 for(int i=0;i<v.size();i++)ret[i]=Integer(v[i]); 315 331 return ret; 316 332 } -
gfanlib/gfanlib_z.h
r9e7d85 rc4d065 163 163 return mpz_get_si(value); 164 164 } 165 bool fitsInInt()const 166 { 167 mpz_t v; 168 mpz_init(v); 169 this->setGmp(v); 170 bool ret=(mpz_fits_sint_p(v)!=0); 171 mpz_clear(v); 172 return ret; 173 } 174 int toInt()const 175 { 176 mpz_t v; 177 mpz_init(v); 178 this->setGmp(v); 179 int ret=0; 180 if(mpz_fits_sint_p(v)) 181 ret=mpz_get_si(v); 182 // else 183 // ok=false; 184 mpz_clear(v); 185 return ret; 186 } 165 187 }; 166 188 -
gfanlib/gfanlib_zfan.cpp
r9e7d85 rc4d065 7 7 8 8 #include "gfanlib_zfan.h" 9 #include "gfanlib_polymakefile.h" 10 11 using namespace std; 9 12 10 13 namespace gfan … … 54 57 assert(coneCollection); 55 58 complex = new SymmetricComplex(coneCollection->toSymmetricComplex()); 59 std::cerr<<"D"<<std::endl; 56 60 complex->buildConeLists(false,false,&cones); 61 std::cerr<<"D"<<std::endl; 57 62 complex->buildConeLists(true,false,&maximalCones); 63 std::cerr<<"D"<<std::endl; 58 64 complex->buildConeLists(false,true,&coneOrbits); 65 std::cerr<<"D"<<std::endl; 59 66 complex->buildConeLists(true,true,&maximalConeOrbits); 60 } 61 } 67 std::cerr<<"D"<<std::endl; 68 } 69 } 70 ZFan::ZFan(std::istream &f): 71 coneCollection(0), 72 complex(0) 73 { 74 // PolyhedralFan PolyhedralFan::readFan(string const &filename, bool onlyMaximal, IntegerVector *w, set<int> const *coneIndices, SymmetryGroup const *sym, bool readCompressedIfNotSym) 75 PolymakeFile inFile; 76 //assert(0); 77 inFile.open(f); 78 79 int n=inFile.readCardinalProperty("AMBIENT_DIM").toInt(); 80 int nRays=inFile.readCardinalProperty("N_RAYS").toInt(); 81 ZMatrix rays=inFile.readMatrixProperty("RAYS",nRays,n); 82 int linealityDim=inFile.readCardinalProperty("LINEALITY_DIM").toInt(); 83 ZMatrix linealitySpace=inFile.readMatrixProperty("LINEALITY_SPACE",linealityDim,n); 84 85 SymmetryGroup sym(n); 86 bool readingSymmetricComplex=false; 87 if(inFile.hasProperty("SYMMETRY_GENERATORS")) 88 { 89 sym.computeClosure(ZToIntMatrix(inFile.readMatrixProperty("SYMMETRY_GENERATORS",-1,n))); 90 readingSymmetricComplex=true; 91 } 92 93 94 const char *sectionName=0; 95 const char *sectionNameMultiplicities=0; 96 if(readingSymmetricComplex) 97 { 98 if(inFile.hasProperty("MAXIMAL_CONES_ORBITS")) 99 { 100 sectionName="MAXIMAL_CONES_ORBITS"; 101 sectionNameMultiplicities="MULTIPLICITIES_ORBITS"; 102 } 103 else 104 { 105 sectionName="CONES_ORBITS"; 106 } 107 } 108 else 109 { 110 if(inFile.hasProperty("MAXIMAL_CONES")) 111 { 112 sectionName="MAXIMAL_CONES"; 113 sectionNameMultiplicities="MULTIPLICITIES"; 114 } 115 else 116 { 117 sectionName="CONES"; 118 } 119 } 120 121 /* if(sym || readCompressedIfNotSym) 122 { 123 sectionName=(onlyMaximal)?"MAXIMAL_CONES_ORBITS":"CONES_ORBITS"; 124 sectionNameMultiplicities=(onlyMaximal)?"MULTIPLICITIES_ORBITS":"DUMMY123"; 125 } 126 else 127 */ 128 /*{ 129 sectionName="MAXIMAL_CONES";//(onlyMaximal)?"MAXIMAL_CONES":"CONES"; 130 sectionNameMultiplicities="MULTIPLICITIES";//(onlyMaximal)?"MULTIPLICITIES":"DUMMY123"; 131 } 132 */ 133 // ZVector w2(n); 134 // if(w==0)w=&w2; 135 136 // SymmetryGroup sym2(n); 137 // if(sym==0)sym=&sym2; 138 139 /* sectionName=0; 140 if(inFile.hasProperty("MAXIMAL_CONES")) 141 sectionName="MAXIMAL_CONES"; 142 else 143 { if(inFile.hasProperty("CONES")) 144 sectionName="CONES"; 145 else 146 assert(0); 147 }*/ 148 149 vector<list<int> > cones=inFile.readMatrixIncidenceProperty(sectionName); 150 // IntegerVectorList r; 151 152 bool hasMultiplicities=inFile.hasProperty(sectionNameMultiplicities); 153 ZMatrix multiplicities(0,0); 154 if(hasMultiplicities)multiplicities=inFile.readMatrixProperty(sectionNameMultiplicities,cones.size(),1); 155 156 ZFan ret(sym); 157 158 // log2 cerr<< "Number of orbits to expand "<<cones.size()<<endl; 159 for(int i=0;i<cones.size();i++) 160 // if(coneIndices==0 || coneIndices->count(i)) 161 { 162 // log2 cerr<<"Expanding symmetries of cone"<<endl; 163 { 164 ZMatrix coneRays(0,n); 165 for(list<int>::const_iterator j=cones[i].begin();j!=cones[i].end();j++) 166 coneRays.appendRow((rays[*j])); 167 ZCone C=ZCone::givenByRays(coneRays,linealitySpace); 168 if(hasMultiplicities)C.setMultiplicity(multiplicities[i][0]); 169 // for(SymmetryGroup::ElementContainer::const_iterator perm=sym->elements.begin();perm!=sym->elements.end();perm++) 170 { 171 // if(C.contains(perm.applyInverse(*w))) 172 // { 173 // PolyhedralCone C2=C.permuted(*perm); 174 // C2.canonicalize(); 175 // ret.insert(C2); 176 // } 177 ret.insert(C); 178 } 179 } 180 } 181 // return ret; 182 *this=ret; 183 } 184 62 185 ZFan::~ZFan() 63 186 { … … 90 213 if(this!=&f) 91 214 { 215 std::cerr<<"COPYING\n"; 92 216 if(complex) 93 217 { … … 95 219 complex=0; 96 220 } 221 std::cerr<<"1COPYING\n"; 97 222 if(coneCollection) 98 223 { … … 100 225 coneCollection=0; 101 226 } 227 std::cerr<<"2COPYING\n"; 102 228 if(f.coneCollection) 103 229 { 104 230 coneCollection=new PolyhedralFan(*f.coneCollection); 105 231 } 232 std::cerr<<"3COPYING\n"; 106 233 if(f.complex) 107 234 { 108 235 complex=new SymmetricComplex(*f.complex); 109 236 } 237 std::cerr<<"DONE COPYING\n"; 110 238 } 111 239 return *this; … … 165 293 return complex->toString(flags);//complex->getMinDim(),complex->getMaxDim(),0,0); 166 294 // return "NEEDTOFIXTHIS"; 295 167 296 //return theFan.toString(); 168 297 } -
gfanlib/gfanlib_zfan.h
r9e7d85 rc4d065 62 62 ~ZFan(); 63 63 ZFan(ZFan const& f); 64 /** 65 * 66 * To read from string, do the following: 67 * std::string test="TEST"; 68 * std::istringstream s(test); 69 * ZFan G(s); 70 * 71 */ 72 ZFan(std::istream &f); 64 73 ZFan& operator=(ZFan const &f); 65 74 /**
Note: See TracChangeset
for help on using the changeset viewer.