- Timestamp:
- Oct 14, 2014, 10:31:31 PM (9 years ago)
- Branches:
- (u'spielwiese', 'e7cc1ebecb61be8b9ca6c18016352af89940b21a')
- Children:
- 97351e66f70a4390d6f911ee38436e695b8ec551
- Parents:
- 5a60835ee02dcb3d57c9e469c5d50e25ec5d29db
- git-author:
- Yue Ren <ren@mathematik.uni-kl.de>2014-10-14 23:31:31+03:00
- git-committer:
- Yue Ren <ren@mathematik.uni-kl.de>2015-02-06 13:47:01+01:00
- Location:
- gfanlib
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
gfanlib/gfanlib_matrix.h
r5a6083 r5ff68b 19 19 std::vector<Vector<typ> > rows; 20 20 public: 21 // rowIterator; 22 // std::vector<Vector<typ> >::iterator rowsBegin(){return rows.begin();} 23 // std::vector<Vector<typ> >::iterator rowsEnd(){return rows.end();} 21 24 inline int getHeight()const{return height;}; 22 25 inline int getWidth()const{return width;}; … … 76 79 { 77 80 assert(rows.size()>0); 78 rows. resize(rows.size()-1);81 rows.pop_back(); 79 82 height--; 80 83 } … … 184 187 return f; 185 188 } 189 190 std::string toString()const 191 { 192 std::stringstream f; 193 f<<*this; 194 return f.str(); 195 } 196 186 197 /** 187 198 Swaps the i th and the j th row. … … 296 307 } 297 308 /** 298 Performs a Gauss reduction and returns the number of row swaps 299 done. 309 Performs a Gauss reduction and returns the number of row swaps (and negative scalings) 310 done. The result is a matrix in row echelon form. The pivots may 300 311 not be all 1. In terms of Groebner bases, what is computed is a 301 312 minimal (not necessarily reduced) Groebner basis of the linear … … 309 320 { 310 321 assert(integral || typ::isField()); 322 assert(!makePivotsOne || !integral); 323 311 324 int retSwaps=0; 312 325 int currentRow=0; … … 325 338 if(makePivotsOne) 326 339 {//THE PIVOT SHOULD BE SET TO ONE IF INTEGRAL IS FALSE 327 if(rows[currentRow][i].sign()>=0) 328 retSwaps++; 340 if(rows[currentRow][i].sign()>=0)retSwaps++; 329 341 typ inverse=typ(1)/rows[currentRow][i]; 330 342 // if(!rows[currentRow][i].isOne()) … … 517 529 int reduceAndComputeRank() 518 530 { 519 if (typ::isField()) 520 reduce(); 521 else 522 reduce(false,true,false); 531 reduce(false,!typ::isField(),false); 523 532 int ret=0; 524 533 int pivotI=-1; -
gfanlib/gfanlib_polyhedralfan.cpp
r5a6083 r5ff68b 398 398 std::set<int> indices; 399 399 400 //for(int j=0;j<rays.getHeight();j++)if(cone.contains(rays[j]))indices.insert(j);400 // for(int j=0;j<rays.getHeight();j++)if(cone.contains(rays[j]))indices.insert(j); 401 401 402 402 ZMatrix l=cone.extremeRays(&generatorsOfLinealitySpace); … … 502 502 } 503 503 504 std::string PolyhedralFan::toString(int /*flags*/)const504 std::string PolyhedralFan::toString(int flags)const 505 505 //void PolyhedralFan::printWithIndices(class Printer *p, bool printMultiplicities, SymmetryGroup *sym, bool group, bool ignoreCones, bool xml, bool tPlaneSort, vector<string> const *comments)const 506 506 { … … 862 862 int PolyhedralFan::dimensionOfLinealitySpace()const 863 863 { 864 if(cones.size()) //slow! 865 return 0; 866 else 867 return cones.begin()->dimensionOfLinealitySpace(); 864 assert(cones.size());//slow! 865 return cones.begin()->dimensionOfLinealitySpace(); 868 866 } 869 867 -
gfanlib/gfanlib_polyhedralfan.h
r5a6083 r5ff68b 24 24 typedef std::map<int,IntVectorList> IncidenceList; 25 25 26 class PolyhedralFan ; 27 26 class PolyhedralFan; 28 27 PolyhedralFan refinement(const PolyhedralFan &a, const PolyhedralFan &b, int cutOffDimension=-1, bool allowASingleConeOfCutOffDimension=false); 29 28 … … 55 54 int getMaxDimension()const; 56 55 int getMinDimension()const; 57 58 // friend PolyhedralFan refinement(const PolyhedralFan &a, const PolyhedralFan &b, int cutOffDimension=-1, bool allowASingleConeOfCutOffDimension=false); 59 56 // friend PolyhedralFan refinement(const PolyhedralFan &a, const PolyhedralFan &b, int cutOffDimension=-1, bool allowASingleConeOfCutOffDimension=false); 60 57 ZMatrix getRays(int dim=1);//This can be called for other dimensions than 1. The term "Rays" still makes sense modulo the common linearity space 61 58 ZMatrix getRelativeInteriorPoints(); -
gfanlib/gfanlib_polymakefile.cpp
r5a6083 r5ff68b 9 9 10 10 #include <assert.h> 11 #include <stdio.h> 11 12 #include <sstream> 12 13 #include <istream> 13 #include <stdio.h>14 14 15 15 using namespace std; … … 53 53 list<int> ret; 54 54 int c=s.peek(); 55 while(((c>='0') && (c<='9')) 55 while(((c>='0') && (c<='9'))|| (c==' ')) 56 56 { 57 57 // fprintf(Stderr,"?\n"); … … 171 171 else 172 172 { 173 //fprintf(f,"_application %s\n",application.c_str());174 //fprintf(f,"_version 2.2\n");175 //fprintf(f,"_type %s\n",type.c_str());173 fprintf(f,"_application %s\n",application.c_str()); 174 fprintf(f,"_version 2.2\n"); 175 fprintf(f,"_type %s\n",type.c_str()); 176 176 177 177 for(list<PolymakeProperty>::const_iterator i=properties.begin();i!=properties.end();i++) … … 201 201 else 202 202 { 203 //file << "_application " << application << endl;204 //file << "_version 2.2\n";205 //file << "_type " << type << endl;203 file << "_application " << application << endl; 204 file << "_version 2.2\n"; 205 file << "_type " << type << endl; 206 206 207 207 for(list<PolymakeProperty>::const_iterator i=properties.begin();i!=properties.end();i++) -
gfanlib/gfanlib_q.h
r5a6083 r5ff68b 31 31 { 32 32 mpq_init(value); 33 // mpz_init_set_si(mpq_numref(value), value_); 34 // mpz_init_set_ui(mpq_denref(value), 1); 33 35 mpz_set_si(mpq_numref(value), value_); 34 36 mpz_set_ui(mpq_denref(value), 1); … … 48 50 { 49 51 mpq_init(value); 52 // mpz_init_set(mpq_numref(value), value_.value); 53 // mpz_init_set_ui(mpq_denref(value), 1); 50 54 mpz_set(mpq_numref(value), value_.value); 51 55 mpz_set_ui(mpq_denref(value), 1); … … 156 160 return mpq_sgn(value); 157 161 } 158 static Rational gcd(Rational const &a, Rational const /*&b*/, Rational /*&s*/, Rational /*t*/)162 static Rational gcd(Rational const &a, Rational const &b, Rational &s, Rational &t) 159 163 { 160 164 /* mpz_t r; -
gfanlib/gfanlib_symmetriccomplex.cpp
r5a6083 r5ff68b 59 59 sum+=vertices[indices[i]]; 60 60 61 intn=sum.size();61 unsigned n=sum.size(); 62 62 Permutation const &bestPermutation=sortKeyPermutation; 63 63 64 assert( (int)bestPermutation.size()==n);64 assert(bestPermutation.size()==n); 65 65 66 66 IntVector indicesNew(indices.size()); … … 88 88 bool SymmetricComplex::Cone::isSubsetOf(Cone const &c)const 89 89 { 90 intnext=0;90 unsigned next=0; 91 91 for(unsigned i=0;i<indices.size();i++) 92 92 { 93 93 while(1) 94 94 { 95 if(next>= (int)c.indices.size())return false;95 if(next>=c.indices.size())return false; 96 96 if(indices[i]==c.indices[next])break; 97 97 next++; … … 183 183 184 184 185 int SymmetricComplex::getLinDim()const 186 { 187 return linealitySpace.getHeight(); 188 } 189 185 190 int SymmetricComplex::getMaxDim()const 186 191 { … … 199 204 } 200 205 201 202 int SymmetricComplex::getLinDim()const203 {204 ZMatrix zm=linealitySpace;205 return zm.reduceAndComputeRank();206 }207 206 208 207 bool SymmetricComplex::isMaximal(Cone const &c)const … … 248 247 #endif 249 248 250 void SymmetricComplex::buildConeLists(bool onlyMaximal, bool compressed, std::vector<std::vector<IntVector > >*conelist /*, ZMatrix *multiplicities*/)const249 void SymmetricComplex::buildConeLists(bool onlyMaximal, bool compressed, std::vector<std::vector<IntVector > >*conelist, std::vector<std::vector<Integer > > *multiplicities)const 251 250 { 252 251 int dimLow=this->linealitySpace.getHeight(); … … 254 253 if(dimHigh<dimLow)dimHigh=dimLow-1; 255 254 if(conelist)*conelist=std::vector<std::vector<IntVector> >(dimHigh-dimLow+1); 255 if(multiplicities)*multiplicities=std::vector<std::vector<Integer> >(dimHigh-dimLow+1); 256 256 for(int d=dimLow;d<=dimHigh;d++) 257 257 { … … 262 262 int I=0; 263 263 for(ConeContainer::const_iterator i=cones.begin();i!=cones.end();i++,I++) 264 if(i->dimension==d)265 {266 numberOfOrbitsOfThisDimension++;264 if(i->dimension==d) 265 { 266 numberOfOrbitsOfThisDimension++; 267 267 if(!onlyMaximal || isMaximal(*i)) 268 268 { … … 270 270 // bool isMax=isMaximal(*i); 271 271 // bool newOrbit=true; 272 std::set<std:: set<int> > temp;273 for(SymmetryGroup::ElementContainer::const_iterator k=sym.elements.begin();k!=sym.elements.end();k++)274 {272 std::set<std::pair<std::set<int>,Integer> > temp; 273 for(SymmetryGroup::ElementContainer::const_iterator k=sym.elements.begin();k!=sym.elements.end();k++) 274 { 275 275 Cone temp1=i->permuted(*k,*this,false); 276 temp.insert( temp1.indexSet());276 temp.insert(std::pair<std::set<int>,Integer>(temp1.indexSet(),temp1.multiplicity)); 277 277 if(compressed)break; 278 278 } 279 for(std::set<std:: set<int> >::const_iterator j=temp.begin();j!=temp.end();j++)279 for(std::set<std::pair<std::set<int>,Integer> >::const_iterator j=temp.begin();j!=temp.end();j++) 280 280 { 281 281 IntVector temp; 282 for(std::set<int>::const_iterator k=j-> begin();k!=j->end();k++)temp.push_back(*k);282 for(std::set<int>::const_iterator k=j->first.begin();k!=j->first.end();k++)temp.push_back(*k); 283 283 if(conelist)(*conelist)[d-dimLow].push_back(temp); 284 if(multiplicities)(*multiplicities)[d-dimLow].push_back(j->second); 284 285 /* if(isMax)if(multiplicities) 285 286 { … … 293 294 // newDimension=false; 294 295 } 295 296 }297 } 298 } 299 300 } 301 302 std::string SymmetricComplex::toStringJustCones(int dimLow, int dimHigh, bool onlyMaximal, bool group, std::ostream *multiplicities, bool compressed, bool /*tPlaneSort*/)const296 } 297 } 298 } 299 } 300 301 } 302 303 std::string SymmetricComplex::toStringJustCones(int dimLow, int dimHigh, bool onlyMaximal, bool group, std::ostream *multiplicities, bool compressed, bool tPlaneSort)const 303 304 { 304 305 std::stringstream ret; … … 365 366 366 367 367 std::string SymmetricComplex::toStringJustRaysAndMaximalCones(int flags)const368 {369 PolymakeFile polymakeFile;370 polymakeFile.create("NONAME","PolyhedralFan","PolyhedralFan",flags&FPF_xml);371 polymakeFile.writeMatrixProperty("RAYS",vertices,true);372 polymakeFile.writeStringProperty("MAXIMAL_CONES",toStringJustCones(getMinDim(),getMaxDim(),true,flags&FPF_group, 0,false,flags&FPF_tPlaneSort));373 374 std::stringstream s;375 polymakeFile.writeStream(s);376 return s.str();377 }378 379 380 368 ZVector SymmetricComplex::fvector(bool boundedPart)const 381 369 { … … 538 526 polymakeFile.writeCardinalProperty("LINEALITY_DIM",linealitySpace.getHeight()); 539 527 // polymakeFile.writeMatrixProperty("RAYS",rays,true,comments); 540 polymakeFile.writeMatrixProperty("RAYS",vertices,true);528 polymakeFile.writeMatrixProperty("RAYS",vertices,true); 541 529 polymakeFile.writeCardinalProperty("N_RAYS",vertices.getHeight()); 542 530 … … 606 594 607 595 608 polymakeFile.writeStringProperty("CONES",toStringJustCones(getMinDim(),getMaxDim(),false,flags&FPF_group, 0,false,flags&FPF_tPlaneSort)); 609 polymakeFile.writeStringProperty("MAXIMAL_CONES",toStringJustCones(getMinDim(),getMaxDim(),true,flags&FPF_group, 0,false,flags&FPF_tPlaneSort)); 610 polymakeFile.writeStringProperty("CONES_ORBITS",toStringJustCones(getMinDim(),getMaxDim(),false,flags&FPF_group, 0,true,flags&FPF_tPlaneSort)); 611 polymakeFile.writeStringProperty("MAXIMAL_CONES_ORBITS",toStringJustCones(getMinDim(),getMaxDim(),true,flags&FPF_group, 0,true,flags&FPF_tPlaneSort)); 596 if(flags&FPF_cones)polymakeFile.writeStringProperty("CONES",toStringJustCones(getMinDim(),getMaxDim(),false,flags&FPF_group, 0,false,flags&FPF_tPlaneSort)); 597 std::stringstream multiplicities; 598 if(flags&FPF_maximalCones)polymakeFile.writeStringProperty("MAXIMAL_CONES",toStringJustCones(getMinDim(),getMaxDim(),true,flags&FPF_group, &multiplicities,false,flags&FPF_tPlaneSort)); 599 if(flags&FPF_conesCompressed)polymakeFile.writeStringProperty("CONES_ORBITS",toStringJustCones(getMinDim(),getMaxDim(),false,flags&FPF_group, 0,true,flags&FPF_tPlaneSort)); 600 if((flags&FPF_conesCompressed) && (flags&FPF_maximalCones))polymakeFile.writeStringProperty("MAXIMAL_CONES_ORBITS",toStringJustCones(getMinDim(),getMaxDim(),true,flags&FPF_group, 0,true,flags&FPF_tPlaneSort)); 601 if(flags&FPF_multiplicities)polymakeFile.writeStringProperty("MULTIPLICITIES",multiplicities.str()); 612 602 613 603 if(!sym.isTrivial()) … … 647 637 stringstream multiplicities; 648 638 polymakeFile.writeStringProperty("MAXIMAL_CONES",symCom.toString(symCom.getMinDim(),symCom.getMaxDim(),true,flags&FPF_group, &multiplicities,false,flags&FPF_tPlaneSort)); 649 if(flags&FPF_multiplicities)polymakeFile.writeStringProperty("MULTIPLICITIES",multiplicities.str());650 639 // log1 fprintf(Stderr,"Done producing list of maximal cones.\n"); 651 640 } -
gfanlib/gfanlib_symmetriccomplex.h
r5a6083 r5ff68b 36 36 class SymmetricComplex{ 37 37 int n; 38 ZMatrix linealitySpace; 38 ZMatrix linealitySpace; // Has full row rank. 39 39 ZMatrix vertices; 40 40 std::map<ZVector,int> indexMap; … … 85 85 bool isPure()const; 86 86 ZVector fvector(bool boundedPart=false)const; 87 void buildConeLists(bool onlyMaximal, bool compressed, std::vector<std::vector<IntVector > >*conelist /*, ZMatrix *multiplicities*/)const;87 void buildConeLists(bool onlyMaximal, bool compressed, std::vector<std::vector<IntVector > >*conelist, std::vector<std::vector<Integer > > *multiplicities=0)const; 88 88 std::string toStringJustCones(int dimLow, int dimHigh, bool onlyMaximal, bool group, std::ostream *multiplicities=0, bool compressed=false, bool tPlaneSort=false)const; 89 std::string toStringJustRaysAndMaximalCones(int flags=0)const;90 89 std::string toString(int flags=0)const; 91 90 bool isSimplicial()const; -
gfanlib/gfanlib_symmetry.cpp
r5a6083 r5ff68b 352 352 return ret; 353 353 } 354 #if 0 355 IntegerVector SymmetryGroup::orbitRepresentativeFixing(IntegerVector const &v, IntegerVector const &fixed)const354 355 ZVector SymmetryGroup::orbitRepresentativeFixing(ZVector const &v, ZVector const &fixed)const 356 356 { 357 357 if(trie){ 358 return compose(trie->searchStabalizer(v,fixed),v);359 } 360 IntegerVector ret=v;358 return trie->searchStabalizer(v,fixed).apply(v); 359 } 360 ZVector ret=v; 361 361 362 362 for(ElementContainer::const_iterator i=elements.begin();i!=elements.end();i++) 363 if( compose(*i,fixed)==fixed)363 if(i->apply(fixed)==fixed) 364 364 { 365 IntegerVector q=compose(*i,v);365 ZVector q=i->apply(v); 366 366 if(ret<q)ret=q; 367 367 } 368 368 if(trie){ 369 IntegerVector temp=compose(trie->searchStabalizer(v,fixed),v);369 ZVector temp=trie->searchStabalizer(v,fixed).apply(v); 370 370 // debug<<"Input"<<v; 371 371 // debug<<"Brute"<<ret; … … 376 376 return ret; 377 377 } 378 #endif379 378 380 379 bool Permutation::isPermutation(IntVector const &a) -
gfanlib/gfanlib_vector.h
r5a6083 r5ff68b 14 14 #include <algorithm> 15 15 #include <iostream> 16 #include <sstream> 16 17 17 18 #include "gfanlib_z.h" … … 289 290 return f<<")"; 290 291 } 292 293 std::string toString()const 294 { 295 std::stringstream f; 296 f<<*this; 297 return f.str(); 298 } 299 291 300 typ gcd()const 292 301 { … … 393 402 394 403 return ret; 395 } 396 397 } 398 404 }; 405 406 }; 399 407 400 408 #endif /* LIB_ZVECTOR_H_ */ -
gfanlib/gfanlib_z.h
r5a6083 r5ff68b 15 15 #if OLD 16 16 #include "gmp.h" 17 18 #if (__GNU_MP_VERSION == 4) && (__GNU_MP_VERSION_MINOR<2)19 extern void * (*__gmp_allocate_func) __GMP_PROTO ((size_t));20 extern void * (*__gmp_reallocate_func) __GMP_PROTO ((void *, size_t, size_t));21 extern void (*__gmp_free_func) __GMP_PROTO ((void *, size_t));22 23 static inline void24 mp_get_memory_functions (void *(**alloc_func) (size_t),25 void *(**realloc_func) (void *, size_t, size_t),26 void (**free_func) (void *, size_t))27 {28 if (alloc_func != NULL)29 *alloc_func = __gmp_allocate_func;30 31 if (realloc_func != NULL)32 *realloc_func = __gmp_reallocate_func;33 34 if (free_func != NULL)35 *free_func = __gmp_free_func;36 }37 #endif38 17 39 18 namespace gfan{ -
gfanlib/gfanlib_zcone.cpp
r5a6083 r5ff68b 10 10 #include <vector> 11 11 #include <set> 12 13 14 #include "config.h" 15 16 #ifdef HAVE_CDD_SETOPER_H 12 #include <sstream> 13 14 //extern "C"{ 17 15 #include "cdd/setoper.h" 18 16 #include "cdd/cdd.h" 19 #elif HAVE_CDDLIB_SETOPER_H 20 #include "cddlib/setoper.h" 21 #include "cddlib/cdd.h" 22 #else 23 #include "setoper.h" 24 #include "cdd.h" 25 #endif 17 //} 26 18 27 19 namespace gfan{ … … 48 40 dd_RepresentationType rep=dd_Inequality; 49 41 // dd_boolean found=dd_FALSE, newformat=dd_FALSE, successful=dd_FALSE; 50 //char command[dd_linelenmax], comsave[dd_linelenmax];42 char command[dd_linelenmax], comsave[dd_linelenmax]; 51 43 dd_NumberType NT; 52 44 … … 68 60 for (j = 1; j < d_input; j++) { 69 61 g[i][j-1].setGmp(mpq_numref(M->matrix[i][j])); 70 mpz_ init_set_ui(mpq_denref(M->matrix[i][j]), 1);62 mpz_set_ui(mpq_denref(M->matrix[i][j]), 1); 71 63 mpq_canonicalize(M->matrix[i][j]); 72 64 } … … 111 103 { 112 104 bool ret; 113 dd_MatrixPtr M=NULL/*,M2=NULL,M3=NULL*/; 105 // dd_MatrixPtr M=NULL,M2=NULL,M3=NULL; 106 dd_MatrixPtr M=NULL; 114 107 // dd_colrange d; 115 108 dd_ErrorType err=dd_NoError; … … 117 110 // dd_colset ignoredcols, basiscols; 118 111 // dd_DataFileType inputfile; 119 //FILE *reading=NULL;112 FILE *reading=NULL; 120 113 121 114 cddinitGmp(); … … 336 329 { 337 330 cddinitGmp(); 331 338 332 int numberOfEqualities=equations.getHeight(); 339 333 int numberOfInequalities=inequalities.getHeight(); … … 451 445 void dual(ZMatrix const &inequalities, ZMatrix const &equations, ZMatrix &dualInequalities, ZMatrix &dualEquations) 452 446 { 453 //int result;447 int result; 454 448 455 449 dd_MatrixPtr A=NULL; 456 450 dd_ErrorType err=dd_NoError; 457 451 458 452 cddinitGmp(); 459 453 460 454 A=ZMatrix2MatrixGmp(inequalities, equations, &err); … … 475 469 476 470 return; 477 //_L99:478 //assert(0);471 _L99: 472 assert(0); 479 473 } 480 474 // this procedure is take from cddio.c. … … 606 600 607 601 return ret; 608 //_L99:609 //assert(0);610 //return std::vector<std::vector<int> >();602 _L99: 603 assert(0); 604 return std::vector<std::vector<int> >(); 611 605 } 612 606 … … 702 696 QMatrix m=ZToQMatrix(equations); 703 697 m.reduce(); 704 m.REformToRREform( true);698 m.REformToRREform(); 705 699 ZMatrix inequalities2(0,equations.getWidth()); 706 700 for(int i=0;i<inequalities.getHeight();i++) … … 710 704 inequalities=LpSolver::fastNormals(inequalities2); 711 705 goto noFallBack; 712 //fallBack://alternativ (disabled)713 //lpSolver.removeRedundantRows(inequalities,equations,true);706 fallBack://alternativ (disabled) 707 lpSolver.removeRedundantRows(inequalities,equations,true); 714 708 noFallBack:; 715 709 } … … 721 715 QMatrix equations2=ZToQMatrix(equations); 722 716 equations2.reduce(false,false,true); 723 equations2.REformToRREform( );717 equations2.REformToRREform(true); 724 718 for(int i=0;i<inequalities.getHeight();i++) 725 719 { … … 733 727 } 734 728 735 voidoperator<<(std::ostream &f, ZCone const &c)729 std::ostream &operator<<(std::ostream &f, ZCone const &c) 736 730 { 737 731 f<<"Ambient dimension:"<<c.n<<std::endl; … … 740 734 f<<"Equations:"<<std::endl; 741 735 f<<c.equations<<std::endl; 742 } 743 736 return f; 737 } 738 739 std::string ZCone::toString()const 740 { 741 std::stringstream f; 742 f<<*this; 743 return f.str(); 744 } 744 745 745 746 ZCone::ZCone(int ambientDimension): … … 934 935 ZCone ZCone::givenByRays(ZMatrix const &generators, ZMatrix const &linealitySpace) 935 936 { 936 ZCone dual(generators,linealitySpace); 937 //rewrite modulo lineality space 938 /* ZMatrix newGenerators(generators.getHeight(),generators.getWidth()); 939 { 940 QMatrix l=ZToQMatrix(linealitySpace); 941 l.reduce(); 942 for(int i=0;i<generators.getHeight();i++) 943 newGenerators[i]=QToZVectorPrimitive(l.canonicalize(ZToQVector(generators[i]))); 944 } 945 */ 946 // ZCone dual(newGenerators,linealitySpace); 947 ZCone dual(generators,linealitySpace); 948 // dual.findFacets(); 949 // dual.canonicalize(); 937 950 ZMatrix inequalities=dual.extremeRays(); 951 952 /* ZMatrix span=generators; 953 span.append(linealitySpace); 954 QMatrix m2Q=ZToQMatrix(span); 955 ZMatrix equations=QToZMatrixPrimitive(m2Q.reduceAndComputeKernel()); 956 */ 938 957 ZMatrix equations=dual.generatorsOfLinealitySpace(); 939 940 return ZCone(inequalities,equations,3); 958 // equations.reduce();equations.removeZeroRows(); 959 960 961 return ZCone(inequalities,equations,PCP_impliedEquationsKnown|PCP_facetsKnown); 941 962 } 942 963 … … 1223 1244 { 1224 1245 if(!contains(f.getRelativeInteriorPoint()))return false; 1225 ZCone temp1=faceContaining(f.getRelativeInteriorPoint()); 1226 temp1.canonicalize(); 1246 ZCone temp=faceContaining(f.getRelativeInteriorPoint()); 1247 temp.canonicalize(); 1248 // ZCone temp2=*this; 1227 1249 ZCone temp2=f; 1228 1250 temp2.canonicalize(); 1229 return !(temp2!=temp1); 1251 // std::cout << temp << std::endl; 1252 // std::cout << temp2 << std::endl; 1253 1254 return !(temp2!=temp); 1230 1255 } 1231 1256 -
gfanlib/gfanlib_zcone.h
r5a6083 r5ff68b 148 148 ZMatrix generatorsOfSpan()const; 149 149 /** 150 * Compute generators of the lineality space of the cone. The y are stored as rows of the returned matrix.150 * Compute generators of the lineality space of the cone. The returned set of generators is a vector spaces basis. They are stored as rows of the returned matrix. 151 151 */ 152 152 ZMatrix generatorsOfLinealitySpace()const; … … 163 163 */ 164 164 bool areExtremeRaysKnown()const{return haveExtremeRaysBeenCached;} 165 165 166 /** 166 167 * Takes the cone to a canonical form. After taking cones to canonical form, two cones are the same … … 342 343 */ 343 344 bool hasFace(ZCone const &f)const; 344 /**345 Computes the face of the cone containing v in its relative interior.346 The vector MUST be contained in the cone.347 */345 /** 346 Computes the face of the cone containing v in its relative interior. 347 The vector MUST be contained in the cone. 348 */ 348 349 ZCone faceContaining(ZVector const &v)const; 349 350 /** … … 351 352 * The ambient space of the returned cone has dimension newn. 352 353 */ 353 // PolyhedralCone projection(int newn)const; 354 friend void operator<<(std::ostream &f, ZCone const &c); 354 // PolyhedralCone projection(int newn)const; 355 friend std::ostream &operator<<(std::ostream &f, ZCone const &c); 356 std::string toString()const; 355 357 }; 356 358 -
gfanlib/gfanlib_zfan.cpp
r5a6083 r5ff68b 37 37 { 38 38 IntVector indices=getConeIndices(dimension,index,orbit,maximal); 39 return this->complex->makeZCone(indices); 39 ZCone ret=this->complex->makeZCone(indices); 40 if(maximal)ret.setMultiplicity(((orbit)?multiplicitiesOrbits:multiplicities)[dimension][index]); 41 return ret; 40 42 } 41 43 IntVector ZFan::getConeIndices(int dimension, int index, bool orbit, bool maximal)const … … 59 61 complex = new SymmetricComplex(coneCollection->toSymmetricComplex()); 60 62 complex->buildConeLists(false,false,&cones); 61 complex->buildConeLists(true,false,&maximalCones );63 complex->buildConeLists(true,false,&maximalCones,&multiplicities); 62 64 complex->buildConeLists(false,true,&coneOrbits); 63 complex->buildConeLists(true,true,&maximalConeOrbits );65 complex->buildConeLists(true,true,&maximalConeOrbits,&multiplicitiesOrbits); 64 66 } 65 67 } … … 316 318 return complex->isPure(); 317 319 } 318 bool ZFan::isComplete()const319 {320 ensureConeCollection();321 if(coneCollection->isEmpty())322 return 0;323 int ambientdim=coneCollection->getAmbientDimension();324 int linealitydim=coneCollection->dimensionOfLinealitySpace();325 return (ambientdim==linealitydim);326 }327 320 void ZFan::insert(ZCone const &c) 328 321 { … … 363 356 } 364 357 365 std::string ZFan::toStringJustRaysAndMaximalCones(int flags)const366 {367 ensureComplex();368 return complex->toStringJustRaysAndMaximalCones(flags);369 }370 371 358 /*int ZFan::getAmbientDimension()const 372 359 { -
gfanlib/gfanlib_zfan.h
r5a6083 r5ff68b 42 42 mutable std::vector<std::vector<IntVector > > cones; 43 43 mutable std::vector<std::vector<IntVector > > maximalCones; 44 mutable std::vector<std::vector<Integer> > multiplicities; // for maximal cones only 44 45 mutable std::vector<std::vector<IntVector > > coneOrbits; 45 46 mutable std::vector<std::vector<IntVector > > maximalConeOrbits; 47 mutable std::vector<std::vector<Integer> > multiplicitiesOrbits; // for maximal cones orbits only 46 48 47 49 … … 105 107 */ 106 108 std::string toString(int flags=0)const; 107 std::string toStringJustRaysAndMaximalCones(int flags=0)const;108 109 /** 109 110 * Returns the dimension of the ambient space. 110 111 */ 111 112 int getAmbientDimension()const; 113 /** 114 * Returns the largest dimension of a cone in the fan. If the fan is empty, then -1 is returned. 115 */ 116 int getDimension()const; 117 /** 118 * Returns the smallest codimension of a cone in the fan. If the fan is empty, then -1 is returned. 119 */ 112 120 int getCodimension()const; 113 int getDimension()const; 121 /** 122 * Returns the dimension of the lineality space of the fan. Notice that the lineality space of the 123 * empty fan is the ambient space. 124 */ 114 125 int getLinealityDimension()const; 126 /** 127 * Returns the f-Vector of the fan. 128 */ 115 129 ZVector getFVector()const; 130 /** 131 * Returns true, if the fan is simplicial. False otherwise. 132 */ 116 133 bool isSimplicial()const; 134 /** 135 * Returns true, if the fan is pure. False otherwise. 136 */ 117 137 bool isPure()const; 118 bool isComplete()const;119 138 /** 120 139 * Inserts c into the fan. … … 137 156 int numberOfConesInCollection()const; 138 157 /** 139 * Returns the largest dimension of a cone in the fan. If the fan is empty, then -1 is returned.140 */141 int dimension()const;142 /**143 * Returns the dimension of the lineality space of the fan. Notice that the lineality space of the144 * empty fan is the ambient space.145 */146 // int getLinealityDimension();147 /**148 158 * Returns the cone in the collection given by the index. It is a mistake to specify an index which 149 159 * is out of range. 150 160 */ 151 ZCone const &getConeInCollection(int index)const;161 // ZCone const &getConeInCollection(int index)const; 152 162 /** 153 163 * Returns the cone in the cone of the fan
Note: See TracChangeset
for help on using the changeset viewer.