Changeset 5ff68b in git


Ignore:
Timestamp:
Oct 14, 2014, 10:31:31 PM (10 years ago)
Author:
Yue Ren <ren@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
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
Message:
chg: new gfanlib version, fixed multiplicities of cones inside fans
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • Singular/dyn_modules/gfanlib/bbfan.cc

    r5a6083 r5ff68b  
    4646  {
    4747    gfan::ZFan* zf = (gfan::ZFan*)d;
    48     std::string s = zf->toStringJustRaysAndMaximalCones();
     48    std::string s = zf->toString(2+4+8+128);
    4949    return omStrDup(s.c_str());
    5050  }
     
    689689}
    690690
    691 BOOLEAN isComplete(leftv res, leftv args)
    692 {
    693   leftv u=args;
    694   if ((u != NULL) && (u->Typ() == fanID))
    695   {
    696     gfan::ZFan* zf = (gfan::ZFan*) u->Data();
    697     int b = zf->isComplete();
    698     res->rtyp = INT_CMD;
    699     res->data = (void*) (long) b;
    700     return FALSE;
    701   }
    702   WerrorS("isComplete: unexpected parameters");
    703   return TRUE;
    704 }
     691// BOOLEAN isComplete(leftv res, leftv args)
     692// {
     693//   leftv u=args;
     694//   if ((u != NULL) && (u->Typ() == fanID))
     695//   {
     696//     gfan::ZFan* zf = (gfan::ZFan*) u->Data();
     697//     int b = zf->isComplete();
     698//     res->rtyp = INT_CMD;
     699//     res->data = (void*) (long) b;
     700//     return FALSE;
     701//   }
     702//   WerrorS("isComplete: unexpected parameters");
     703//   return TRUE;
     704// }
    705705
    706706BOOLEAN fVector(leftv res, leftv args)
  • gfanlib/gfanlib_matrix.h

    r5a6083 r5ff68b  
    1919  std::vector<Vector<typ> > rows;
    2020public:
     21  // rowIterator;
     22 // std::vector<Vector<typ> >::iterator rowsBegin(){return rows.begin();}
     23//  std::vector<Vector<typ> >::iterator rowsEnd(){return rows.end();}
    2124  inline int getHeight()const{return height;};
    2225  inline int getWidth()const{return width;};
     
    7679  {
    7780    assert(rows.size()>0);
    78     rows.resize(rows.size()-1);
     81    rows.pop_back();
    7982    height--;
    8083  }
     
    184187    return f;
    185188  }
     189
     190  std::string toString()const
     191  {
     192          std::stringstream f;
     193          f<<*this;
     194          return f.str();
     195  }
     196
    186197  /**
    187198     Swaps the i th and the j th row.
     
    296307  }
    297308  /**
    298      Performs a Gauss reduction and returns the number of row swaps
    299      done.  The result is a matrix in row echelon form. The pivots may
     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
    300311     not be all 1.  In terms of Groebner bases, what is computed is a
    301312     minimal (not necessarily reduced) Groebner basis of the linear
     
    309320  {
    310321    assert(integral || typ::isField());
     322    assert(!makePivotsOne || !integral);
     323
    311324    int retSwaps=0;
    312325    int currentRow=0;
     
    325338            if(makePivotsOne)
    326339              {//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++;
    329341                typ inverse=typ(1)/rows[currentRow][i];
    330342                //                if(!rows[currentRow][i].isOne())
     
    517529  int reduceAndComputeRank()
    518530  {
    519     if (typ::isField())
    520       reduce();
    521     else
    522       reduce(false,true,false);
     531    reduce(false,!typ::isField(),false);
    523532    int ret=0;
    524533    int pivotI=-1;
  • gfanlib/gfanlib_polyhedralfan.cpp

    r5a6083 r5ff68b  
    398398  std::set<int> indices;
    399399
    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);
    401401
    402402  ZMatrix l=cone.extremeRays(&generatorsOfLinealitySpace);
     
    502502}
    503503
    504 std::string PolyhedralFan::toString(int /*flags*/)const
     504std::string PolyhedralFan::toString(int flags)const
    505505//void PolyhedralFan::printWithIndices(class Printer *p, bool printMultiplicities, SymmetryGroup *sym, bool group, bool ignoreCones, bool xml, bool tPlaneSort, vector<string> const *comments)const
    506506{
     
    862862int PolyhedralFan::dimensionOfLinealitySpace()const
    863863{
    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();
    868866}
    869867
  • gfanlib/gfanlib_polyhedralfan.h

    r5a6083 r5ff68b  
    2424typedef std::map<int,IntVectorList> IncidenceList;
    2525
    26 class PolyhedralFan ;
    27 
     26class PolyhedralFan;
    2827PolyhedralFan refinement(const PolyhedralFan &a, const PolyhedralFan &b, int cutOffDimension=-1, bool allowASingleConeOfCutOffDimension=false);
    2928
     
    5554  int getMaxDimension()const;
    5655  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);
    6057  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
    6158  ZMatrix getRelativeInteriorPoints();
  • gfanlib/gfanlib_polymakefile.cpp

    r5a6083 r5ff68b  
    99
    1010#include <assert.h>
     11#include <stdio.h>
    1112#include <sstream>
    1213#include <istream>
    13 #include <stdio.h>
    1414
    1515using namespace std;
     
    5353  list<int> ret;
    5454  int c=s.peek();
    55   while(((c>='0') && (c<='9')) || (c==' '))
     55  while(((c>='0') && (c<='9'))|| (c==' '))
    5656    {
    5757      //      fprintf(Stderr,"?\n");
     
    171171  else
    172172    {
    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());
    176176
    177177      for(list<PolymakeProperty>::const_iterator i=properties.begin();i!=properties.end();i++)
     
    201201  else
    202202    {
    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;
    206206
    207207      for(list<PolymakeProperty>::const_iterator i=properties.begin();i!=properties.end();i++)
  • gfanlib/gfanlib_q.h

    r5a6083 r5ff68b  
    3131  {
    3232    mpq_init(value);
     33//    mpz_init_set_si(mpq_numref(value), value_);
     34//    mpz_init_set_ui(mpq_denref(value), 1);
    3335    mpz_set_si(mpq_numref(value), value_);
    3436    mpz_set_ui(mpq_denref(value), 1);
     
    4850  {
    4951    mpq_init(value);
     52//    mpz_init_set(mpq_numref(value), value_.value);
     53//    mpz_init_set_ui(mpq_denref(value), 1);
    5054    mpz_set(mpq_numref(value), value_.value);
    5155    mpz_set_ui(mpq_denref(value), 1);
     
    156160    return mpq_sgn(value);
    157161  }
    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)
    159163  {
    160164/*    mpz_t r;
  • gfanlib/gfanlib_symmetriccomplex.cpp

    r5a6083 r5ff68b  
    5959    sum+=vertices[indices[i]];
    6060
    61   int n=sum.size();
     61  unsigned n=sum.size();
    6262  Permutation const &bestPermutation=sortKeyPermutation;
    6363
    64   assert((int)bestPermutation.size()==n);
     64  assert(bestPermutation.size()==n);
    6565
    6666  IntVector indicesNew(indices.size());
     
    8888bool SymmetricComplex::Cone::isSubsetOf(Cone const &c)const
    8989{
    90   int next=0;
     90  unsigned next=0;
    9191  for(unsigned i=0;i<indices.size();i++)
    9292    {
    9393      while(1)
    9494        {
    95           if(next>=(int)c.indices.size())return false;
     95          if(next>=c.indices.size())return false;
    9696          if(indices[i]==c.indices[next])break;
    9797          next++;
     
    183183
    184184
     185int SymmetricComplex::getLinDim()const
     186{
     187        return linealitySpace.getHeight();
     188}
     189
    185190int SymmetricComplex::getMaxDim()const
    186191{
     
    199204}
    200205
    201 
    202 int SymmetricComplex::getLinDim()const
    203 {
    204   ZMatrix zm=linealitySpace;
    205   return zm.reduceAndComputeRank();
    206 }
    207206
    208207bool SymmetricComplex::isMaximal(Cone const &c)const
     
    248247#endif
    249248
    250 void SymmetricComplex::buildConeLists(bool onlyMaximal, bool compressed, std::vector<std::vector<IntVector > >*conelist/*, ZMatrix *multiplicities*/)const
     249void SymmetricComplex::buildConeLists(bool onlyMaximal, bool compressed, std::vector<std::vector<IntVector > >*conelist, std::vector<std::vector<Integer > > *multiplicities)const
    251250{
    252251  int dimLow=this->linealitySpace.getHeight();
     
    254253  if(dimHigh<dimLow)dimHigh=dimLow-1;
    255254  if(conelist)*conelist=std::vector<std::vector<IntVector> >(dimHigh-dimLow+1);
     255  if(multiplicities)*multiplicities=std::vector<std::vector<Integer> >(dimHigh-dimLow+1);
    256256  for(int d=dimLow;d<=dimHigh;d++)
    257257    {
     
    262262          int I=0;
    263263          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++;
    267267              if(!onlyMaximal || isMaximal(*i))
    268268                {
     
    270270                  // bool isMax=isMaximal(*i);
    271271                  // 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                      {
    275275                        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));
    277277                        if(compressed)break;
    278278                    }
    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++)
    280280                    {
    281281                      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);
    283283                      if(conelist)(*conelist)[d-dimLow].push_back(temp);
     284                      if(multiplicities)(*multiplicities)[d-dimLow].push_back(j->second);
    284285 /*                     if(isMax)if(multiplicities)
    285286                        {
     
    293294                      // newDimension=false;
    294295                    }
    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*/)const
     296              }
     297                    }
     298        }
     299    }
     300
     301}
     302
     303std::string SymmetricComplex::toStringJustCones(int dimLow, int dimHigh, bool onlyMaximal, bool group, std::ostream *multiplicities, bool compressed, bool tPlaneSort)const
    303304{
    304305  std::stringstream ret;
     
    365366
    366367
    367 std::string SymmetricComplex::toStringJustRaysAndMaximalCones(int flags)const
    368 {
    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 
    380368ZVector SymmetricComplex::fvector(bool boundedPart)const
    381369{
     
    538526    polymakeFile.writeCardinalProperty("LINEALITY_DIM",linealitySpace.getHeight());
    539527    //    polymakeFile.writeMatrixProperty("RAYS",rays,true,comments);
    540     polymakeFile.writeMatrixProperty("RAYS",vertices,true);
     528        polymakeFile.writeMatrixProperty("RAYS",vertices,true);
    541529    polymakeFile.writeCardinalProperty("N_RAYS",vertices.getHeight());
    542530
     
    606594
    607595
    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());
    612602
    613603    if(!sym.isTrivial())
     
    647637            stringstream multiplicities;
    648638            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());
    650639  //          log1 fprintf(Stderr,"Done producing list of maximal cones.\n");
    651640          }
  • gfanlib/gfanlib_symmetriccomplex.h

    r5a6083 r5ff68b  
    3636  class SymmetricComplex{
    3737  int n;
    38   ZMatrix linealitySpace;
     38  ZMatrix linealitySpace; // Has full row rank.
    3939  ZMatrix vertices;
    4040  std::map<ZVector,int> indexMap;
     
    8585  bool isPure()const;
    8686  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;
    8888  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;
    9089  std::string toString(int flags=0)const;
    9190  bool isSimplicial()const;
  • gfanlib/gfanlib_symmetry.cpp

    r5a6083 r5ff68b  
    352352  return ret;
    353353}
    354 #if 0
    355 IntegerVector SymmetryGroup::orbitRepresentativeFixing(IntegerVector const &v, IntegerVector const &fixed)const
     354
     355ZVector SymmetryGroup::orbitRepresentativeFixing(ZVector const &v, ZVector const &fixed)const
    356356{
    357357        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;
    361361
    362362  for(ElementContainer::const_iterator i=elements.begin();i!=elements.end();i++)
    363     if(compose(*i,fixed)==fixed)
     363    if(i->apply(fixed)==fixed)
    364364      {
    365         IntegerVector q=compose(*i,v);
     365        ZVector q=i->apply(v);
    366366        if(ret<q)ret=q;
    367367      }
    368368        if(trie){
    369                 IntegerVector temp=compose(trie->searchStabalizer(v,fixed),v);
     369                ZVector temp=trie->searchStabalizer(v,fixed).apply(v);
    370370//              debug<<"Input"<<v;
    371371//              debug<<"Brute"<<ret;
     
    376376  return ret;
    377377}
    378 #endif
    379378
    380379bool Permutation::isPermutation(IntVector const &a)
  • gfanlib/gfanlib_vector.h

    r5a6083 r5ff68b  
    1414#include <algorithm>
    1515#include <iostream>
     16#include <sstream>
    1617
    1718#include "gfanlib_z.h"
     
    289290    return f<<")";
    290291  }
     292
     293  std::string toString()const
     294  {
     295          std::stringstream f;
     296          f<<*this;
     297          return f.str();
     298  }
     299
    291300  typ gcd()const
    292301  {
     
    393402
    394403    return ret;
    395 }
    396 
    397 }
    398 
     404};
     405
     406};
    399407
    400408#endif /* LIB_ZVECTOR_H_ */
  • gfanlib/gfanlib_z.h

    r5a6083 r5ff68b  
    1515#if OLD
    1616#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 void
    24 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 #endif
    3817
    3918namespace gfan{
  • gfanlib/gfanlib_zcone.cpp

    r5a6083 r5ff68b  
    1010#include <vector>
    1111#include <set>
    12 
    13 
    14 #include "config.h"
    15 
    16 #ifdef HAVE_CDD_SETOPER_H
     12#include <sstream>
     13
     14//extern "C"{
    1715#include "cdd/setoper.h"
    1816#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//}
    2618
    2719namespace gfan{
     
    4840    dd_RepresentationType rep=dd_Inequality;
    4941    // 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];
    5143    dd_NumberType NT;
    5244
     
    6860      for (j = 1; j < d_input; j++) {
    6961        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);
    7163        mpq_canonicalize(M->matrix[i][j]);
    7264      }
     
    111103  {
    112104    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;
    114107    // dd_colrange d;
    115108    dd_ErrorType err=dd_NoError;
     
    117110    // dd_colset ignoredcols, basiscols;
    118111    // dd_DataFileType inputfile;
    119     // FILE *reading=NULL;
     112    FILE *reading=NULL;
    120113
    121114    cddinitGmp();
     
    336329  {
    337330    cddinitGmp();
     331
    338332    int numberOfEqualities=equations.getHeight();
    339333    int numberOfInequalities=inequalities.getHeight();
     
    451445  void dual(ZMatrix const &inequalities, ZMatrix const &equations, ZMatrix &dualInequalities, ZMatrix &dualEquations)
    452446  {
    453     // int result;
     447    int result;
    454448
    455449    dd_MatrixPtr A=NULL;
    456450    dd_ErrorType err=dd_NoError;
    457451
    458     cddinitGmp();
     452        cddinitGmp();
    459453
    460454    A=ZMatrix2MatrixGmp(inequalities, equations, &err);
     
    475469
    476470    return;
    477    // _L99:
    478    // assert(0);
     471   _L99:
     472    assert(0);
    479473  }
    480474  // this procedure is take from cddio.c.
     
    606600
    607601    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> >();
    611605  }
    612606
     
    702696          QMatrix m=ZToQMatrix(equations);
    703697          m.reduce();
    704           m.REformToRREform(true);
     698          m.REformToRREform();
    705699          ZMatrix inequalities2(0,equations.getWidth());
    706700          for(int i=0;i<inequalities.getHeight();i++)
     
    710704          inequalities=LpSolver::fastNormals(inequalities2);
    711705          goto noFallBack;
    712         // fallBack://alternativ (disabled)
    713         //   lpSolver.removeRedundantRows(inequalities,equations,true);
     706        fallBack://alternativ (disabled)
     707          lpSolver.removeRedundantRows(inequalities,equations,true);
    714708        noFallBack:;
    715709        }
     
    721715      QMatrix equations2=ZToQMatrix(equations);
    722716      equations2.reduce(false,false,true);
    723       equations2.REformToRREform();
     717      equations2.REformToRREform(true);
    724718      for(int i=0;i<inequalities.getHeight();i++)
    725719        {
     
    733727}
    734728
    735 void operator<<(std::ostream &f, ZCone const &c)
     729std::ostream &operator<<(std::ostream &f, ZCone const &c)
    736730{
    737731  f<<"Ambient dimension:"<<c.n<<std::endl;
     
    740734  f<<"Equations:"<<std::endl;
    741735  f<<c.equations<<std::endl;
    742 }
    743 
     736  return f;
     737}
     738
     739std::string ZCone::toString()const
     740{
     741        std::stringstream f;
     742        f<<*this;
     743        return f.str();
     744}
    744745
    745746ZCone::ZCone(int ambientDimension):
     
    934935ZCone ZCone::givenByRays(ZMatrix const &generators, ZMatrix const &linealitySpace)
    935936{
    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();
    937950  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*/
    938957  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);
    941962}
    942963
     
    12231244{
    12241245  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;
    12271249  ZCone temp2=f;
    12281250  temp2.canonicalize();
    1229   return !(temp2!=temp1);
     1251//  std::cout << temp << std::endl;
     1252//  std::cout << temp2 << std::endl;
     1253
     1254  return !(temp2!=temp);
    12301255}
    12311256
  • gfanlib/gfanlib_zcone.h

    r5a6083 r5ff68b  
    148148     ZMatrix generatorsOfSpan()const;
    149149     /**
    150       * Compute generators of the lineality space of the cone. They 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.
    151151      */
    152152     ZMatrix generatorsOfLinealitySpace()const;
     
    163163      */
    164164     bool areExtremeRaysKnown()const{return haveExtremeRaysBeenCached;}
     165
    165166     /**
    166167      * Takes the cone to a canonical form. After taking cones to canonical form, two cones are the same
     
    342343     */
    343344    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    */
    348349    ZCone faceContaining(ZVector const &v)const;
    349350    /**
     
    351352     * The ambient space of the returned cone has dimension newn.
    352353     */
    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;
    355357};
    356358
  • gfanlib/gfanlib_zfan.cpp

    r5a6083 r5ff68b  
    3737  {
    3838    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;
    4042  }
    4143  IntVector ZFan::getConeIndices(int dimension, int index, bool orbit, bool maximal)const
     
    5961        complex = new SymmetricComplex(coneCollection->toSymmetricComplex());
    6062        complex->buildConeLists(false,false,&cones);
    61         complex->buildConeLists(true,false,&maximalCones);
     63        complex->buildConeLists(true,false,&maximalCones,&multiplicities);
    6264        complex->buildConeLists(false,true,&coneOrbits);
    63         complex->buildConeLists(true,true,&maximalConeOrbits);
     65        complex->buildConeLists(true,true,&maximalConeOrbits,&multiplicitiesOrbits);
    6466      }
    6567  }
     
    316318    return complex->isPure();
    317319  }
    318   bool ZFan::isComplete()const
    319   {
    320     ensureConeCollection();
    321     if(coneCollection->isEmpty())
    322       return 0;
    323     int ambientdim=coneCollection->getAmbientDimension();
    324     int linealitydim=coneCollection->dimensionOfLinealitySpace();
    325     return (ambientdim==linealitydim);
    326   }
    327320  void ZFan::insert(ZCone const &c)
    328321  {
     
    363356}
    364357
    365 std::string ZFan::toStringJustRaysAndMaximalCones(int flags)const
    366 {
    367   ensureComplex();
    368   return complex->toStringJustRaysAndMaximalCones(flags);
    369 }
    370 
    371358/*int ZFan::getAmbientDimension()const
    372359{
  • gfanlib/gfanlib_zfan.h

    r5a6083 r5ff68b  
    4242  mutable std::vector<std::vector<IntVector > > cones;
    4343  mutable std::vector<std::vector<IntVector > > maximalCones;
     44  mutable std::vector<std::vector<Integer> > multiplicities; // for maximal cones only
    4445  mutable std::vector<std::vector<IntVector > > coneOrbits;
    4546  mutable std::vector<std::vector<IntVector > > maximalConeOrbits;
     47  mutable std::vector<std::vector<Integer> > multiplicitiesOrbits; // for maximal cones orbits only
    4648
    4749
     
    105107   */
    106108  std::string toString(int flags=0)const;
    107   std::string toStringJustRaysAndMaximalCones(int flags=0)const;
    108109  /**
    109110   * Returns the dimension of the ambient space.
    110111   */
    111112  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   */
    112120  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   */
    114125  int getLinealityDimension()const;
     126  /**
     127   * Returns the f-Vector of the fan.
     128   */
    115129  ZVector getFVector()const;
     130  /**
     131   * Returns true, if the fan is simplicial. False otherwise.
     132   */
    116133  bool isSimplicial()const;
     134  /**
     135   * Returns true, if the fan is pure. False otherwise.
     136   */
    117137  bool isPure()const;
    118   bool isComplete()const;
    119138  /**
    120139   * Inserts c into the fan.
     
    137156  int numberOfConesInCollection()const;
    138157  /**
    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 the
    144    * empty fan is the ambient space.
    145    */
    146   // int getLinealityDimension();
    147   /**
    148158   * Returns the cone in the collection given by the index. It is a mistake to specify an index which
    149159   * is out of range.
    150160   */
    151   ZCone const &getConeInCollection(int index)const;
     161  //  ZCone const &getConeInCollection(int index)const;
    152162  /**
    153163   * Returns the cone in the cone of the fan
Note: See TracChangeset for help on using the changeset viewer.