Changeset 32d8cb in git


Ignore:
Timestamp:
Oct 25, 2013, 8:34:39 PM (9 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'f875bbaccd0831e36aaed09ff6adeb3eb45aeb94')
Children:
9cf75aab8ce4766fcf49c2135012db6957300a95
Parents:
6a6ae29f7bcf2272aa28c90bb17f8e9a0337de6e62de8de7d677c1aa9a6da3c0e58b04a58a9a884b
Message:
Merge pull request #408 from YueRen/spielwiese

polymake/gfanlib modules
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • dyn_modules/callgfanlib/bbcone.cc

    r6a6ae2 r32d8cb  
    170170}
    171171
    172 void* bbcone_Init(blackbox *b)
     172void* bbcone_Init(blackbox* /*b*/)
    173173{
    174174  return (void*)(new gfan::ZCone());
     
    229229}
    230230
    231 char * bbcone_String(blackbox *b, void *d)
     231char* bbcone_String(blackbox* /*b*/, void *d)
    232232{
    233233  if (d==NULL) return omStrDup("invalid object");
     
    239239}
    240240
    241 void bbcone_destroy(blackbox *b, void *d)
     241void bbcone_destroy(blackbox* /*b*/, void *d)
    242242{
    243243  if (d!=NULL)
     
    248248}
    249249
    250 void* bbcone_Copy(blackbox*b, void *d)
     250void* bbcone_Copy(blackbox* /*b*/, void *d)
    251251{
    252252  gfan::ZCone* zc = (gfan::ZCone*)d;
     
    622622{
    623623  leftv u = args;
    624   if ((u != NULL) && (u->Typ() == coneID))
     624  if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID))
    625625  {
    626626    gfan::ZCone* zc = (gfan::ZCone*)u->Data();
     
    638638{
    639639  leftv u = args;
    640   if ((u != NULL) && (u->Typ() == coneID))
     640  if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID))
    641641  {
    642642    gfan::ZCone* zc = (gfan::ZCone*)u->Data();
     
    653653{
    654654  leftv u = args;
    655   if ((u != NULL) && (u->Typ() == coneID))
     655  if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID))
    656656  {
    657657    gfan::ZCone* zc = (gfan::ZCone*)u->Data();
     
    661661    return FALSE;
    662662  }
    663   if ((u != NULL) && (u->Typ() == polytopeID))
    664     {
    665       gfan::ZCone* zc = (gfan::ZCone*)u->Data();
    666       res->rtyp = BIGINTMAT_CMD;
    667       res->data = (void*) getFacetNormals(zc);
    668       return FALSE;
    669     }
    670663  WerrorS("facets: unexpected parameters");
    671664  return TRUE;
     
    675668{
    676669  leftv u = args;
    677   if ((u != NULL) && (u->Typ() == coneID))
     670  if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID))
    678671  {
    679672    gfan::ZCone* zc = (gfan::ZCone*)u->Data();
     
    690683{
    691684  leftv u = args;
    692   if ((u != NULL) && (u->Typ() == coneID))
     685  if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID))
    693686  {
    694687    gfan::ZCone* zc = (gfan::ZCone*)u->Data();
     
    705698{
    706699  leftv u = args;
    707   if ((u != NULL) && (u->Typ() == coneID))
     700  if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID))
    708701  {
    709702    gfan::ZCone* zc = (gfan::ZCone*)u->Data();
     
    16461639
    16471640
     1641lists listOfFacets(const gfan::ZCone &zc)
     1642{
     1643  gfan::ZMatrix inequalities = zc.getFacets();
     1644  gfan::ZMatrix equations = zc.getImpliedEquations();
     1645  lists L = (lists)omAllocBin(slists_bin);
     1646  int r = inequalities.getHeight();
     1647  int c = inequalities.getWidth();
     1648  L->Init(r);
     1649
     1650  /* next we iterate over each of the r facets, build the respective cone and add it to the list */
     1651  /* this is the i=0 case */
     1652  gfan::ZMatrix newInequalities = inequalities.submatrix(1,0,r,c);
     1653  gfan::ZMatrix newEquations = equations;
     1654  newEquations.appendRow(inequalities[0]);
     1655  L->m[0].rtyp = coneID; L->m[0].data=(void*) new gfan::ZCone(newInequalities,newEquations);
     1656
     1657  /* these are the cases i=1,...,r-2 */
     1658  for (int i=1; i<r-1; i++)
     1659  {
     1660    newInequalities = inequalities.submatrix(0,0,i-1,c);
     1661    newInequalities.append(inequalities.submatrix(i+1,0,r,c));
     1662    newEquations = equations;
     1663    newEquations.appendRow(inequalities[i]);
     1664    L->m[i].rtyp = coneID; L->m[i].data=(void*) new gfan::ZCone(newInequalities,newEquations);
     1665  }
     1666
     1667  /* this is the i=r-1 case */
     1668  newInequalities = inequalities.submatrix(0,0,r-1,c);
     1669  newEquations = equations;
     1670  newEquations.appendRow(inequalities[r]);
     1671  L->m[r-1].rtyp = coneID; L->m[r-1].data=(void*) new gfan::ZCone(newInequalities,newEquations);
     1672
     1673  return L;
     1674}
     1675
     1676
     1677BOOLEAN listOfFacets(leftv res, leftv args)
     1678{
     1679  leftv u=args;
     1680  if ((u != NULL) && (u->Typ() == coneID))
     1681  {
     1682    gfan::ZCone* zc = (gfan::ZCone*) u->Data();
     1683    lists L = listOfFacets(*zc);
     1684    res->rtyp = LIST_CMD;
     1685    res->data = (void*) L;
     1686    return FALSE;
     1687  }
     1688  WerrorS("listOfFacets: unexpected parameters");
     1689  return TRUE;
     1690}
     1691
     1692
    16481693poly initial(poly p)
    16491694{
     
    16841729      ideal I = (ideal) u->Data();
    16851730      ideal inI = idInit(IDELEMS(I));
    1686       poly g; poly h; long d;
     1731      poly g;
    16871732      for (int i=0; i<IDELEMS(I); i++)
    16881733      {
     
    19081953  p->iiAddCproc("","uniquePoint",FALSE,uniquePoint);
    19091954  p->iiAddCproc("","listContainsCone",FALSE,containsCone);
     1955  p->iiAddCproc("","listOfFacets",FALSE,listOfFacets);
    19101956  p->iiAddCproc("","maximalGroebnerCone",FALSE,maximalGroebnerCone);
    19111957  p->iiAddCproc("","groebnerCone",FALSE,groebnerCone);
  • dyn_modules/callgfanlib/bbfan.cc

    r6a6ae2 r32d8cb  
    2525int fanID;
    2626
    27 void* bbfan_Init(blackbox *b)
     27void* bbfan_Init(blackbox* /*b*/)
    2828{
    2929  return (void*) new gfan::ZFan(0);
    3030}
    3131
    32 void bbfan_destroy(blackbox *b, void *d)
     32void bbfan_destroy(blackbox* /*b*/, void *d)
    3333{
    3434  if (d!=NULL)
     
    3939}
    4040
    41 char* bbfan_String(blackbox *b, void *d)
     41char* bbfan_String(blackbox* /*b*/, void *d)
    4242{
    4343  if (d==NULL) return omStrDup("invalid object");
     
    5050}
    5151
    52 void* bbfan_Copy(blackbox*b, void *d)
     52void* bbfan_Copy(blackbox* /*b*/, void *d)
    5353{
    5454  gfan::ZFan* zf = (gfan::ZFan*)d;
     
    502502      leftv w=v->next; int n = 1;
    503503      if ((w != NULL) && (w->Typ() == INT_CMD))
    504         int n = (int)(long) w;
     504        n = (int)(long) w;
    505505
    506506      if (n != 0)
     
    864864}
    865865
    866 lists listOfFacets(const gfan::ZCone &zc)
    867 {
    868   gfan::ZMatrix inequalities = zc.getFacets();
    869   gfan::ZMatrix equations = zc.getImpliedEquations();
    870   lists L = (lists)omAllocBin(slists_bin);
    871   int r = inequalities.getHeight();
    872   int c = inequalities.getWidth();
    873   L->Init(r);
    874 
    875   /* next we iterate over each of the r facets, build the respective cone and add it to the list */
    876   /* this is the i=0 case */
    877   gfan::ZMatrix newInequalities = inequalities.submatrix(1,0,r,c);
    878   gfan::ZMatrix newEquations = equations;
    879   newEquations.appendRow(inequalities[0]);
    880   L->m[0].rtyp = coneID; L->m[0].data=(void*) new gfan::ZCone(newInequalities,newEquations);
    881 
    882   /* these are the cases i=1,...,r-2 */
    883   for (int i=1; i<r-1; i++)
    884   {
    885     newInequalities = inequalities.submatrix(0,0,i-1,c);
    886     newInequalities.append(inequalities.submatrix(i+1,0,r,c));
    887     newEquations = equations;
    888     newEquations.appendRow(inequalities[i]);
    889     L->m[i].rtyp = coneID; L->m[i].data=(void*) new gfan::ZCone(newInequalities,newEquations);
    890   }
    891 
    892   /* this is the i=r-1 case */
    893   newInequalities = inequalities.submatrix(0,0,r-1,c);
    894   newEquations = equations;
    895   newEquations.appendRow(inequalities[r]);
    896   L->m[r-1].rtyp = coneID; L->m[r-1].data=(void*) new gfan::ZCone(newInequalities,newEquations);
    897 
    898   return L;
    899 }
    900 
    901 BOOLEAN listOfFacets(leftv res, leftv args)
    902 {
    903   leftv u=args;
    904   if ((u != NULL) && (u->Typ() == coneID))
    905   {
    906     gfan::ZCone* zc = (gfan::ZCone*) u->Data();
    907     lists L = listOfFacets(*zc);
    908     res->rtyp = LIST_CMD;
    909     res->data = (void*) L;
    910     return FALSE;
    911   }
    912   WerrorS("listOfFacets: unexpected parameters");
    913   return TRUE;
    914 }
    915866
    916867BOOLEAN tropicalVariety(leftv res, leftv args)
  • dyn_modules/callgfanlib/bbpolytope.cc

    r6a6ae2 r32d8cb  
    3838}
    3939
    40 void *bbpolytope_Init(blackbox *b)
     40void *bbpolytope_Init(blackbox* /*b*/)
    4141{
    4242  return (void*)(new gfan::ZCone());
     
    9797}
    9898
    99 char* bbpolytope_String(blackbox *b, void *d)
     99char* bbpolytope_String(blackbox* /*b*/, void *d)
    100100{ if (d==NULL) return omStrDup("invalid object");
    101101   else
     
    107107}
    108108
    109 void bbpolytope_destroy(blackbox *b, void *d)
     109void bbpolytope_destroy(blackbox* /*b*/, void *d)
    110110{
    111111  if (d!=NULL)
     
    116116}
    117117
    118 void* bbpolytope_Copy(blackbox*b, void *d)
     118void* bbpolytope_Copy(blackbox* /*b*/, void *d)
    119119{
    120120  gfan::ZCone* zc = (gfan::ZCone*)d;
     
    358358  WerrorS("vertices: unexpected parameters");
    359359  return TRUE;
    360 }
    361 
    362 bigintmat* getFacetNormals(gfan::ZCone* zc)
    363 {
    364   gfan::ZMatrix zmat = zc->getFacets();
    365   return zMatrixToBigintmat(zmat);
    366360}
    367361
     
    482476  // iiAddCproc("","getCodimension",FALSE,getAmbientDimension);
    483477  // iiAddCproc("","getDimension",FALSE,getDimension);
    484   // iiAddCproc("","getFacetNormals",FALSE,getFacetNormals);
    485478  /********************************************************/
    486479  /* the following functions are identical to those in bbcone.cc */
     480  // iiAddCproc("","facets",FALSE,facets);
    487481  // iiAddCproc("","setLinearForms",FALSE,setLinearForms);
    488482  // iiAddCproc("","getLinearForms",FALSE,getLinearForms);
  • dyn_modules/callgfanlib/gfan.h

    r6a6ae2 r32d8cb  
    261261};
    262262lists lprepareResult(gcone *gc, const int n);
    263 static int64 int64gcd(const int64 &a, const int64 &b);
    264 static int intgcd(const int &a, const int &b);
    265 static int dotProduct(const int64vec &iva, const int64vec &ivb);
    266 static bool isParallel(const int64vec &a, const int64vec &b);
    267 static int64vec *ivNeg(/*const*/ int64vec *iv);
    268 static void idDebugPrint(const ideal &I);
    269 static volatile void showSLA(facet &f);
    270 static bool isMonomial(const ideal &I);
    271 static bool ivAreEqual(const int64vec &a, const int64vec &b);
    272 static bool areEqual2(facet *f, facet *g);
    273 static bool areEqual( facet *f, facet *g);
     263/* static int64 int64gcd(const int64 &a, const int64 &b); */
     264/* static int intgcd(const int &a, const int &b); */
     265/* static int dotProduct(const int64vec &iva, const int64vec &ivb); */
     266/* static bool isParallel(const int64vec &a, const int64vec &b); */
     267/* static int64vec *ivNeg(/\*const*\/ int64vec *iv); */
     268/* static void idDebugPrint(const ideal &I); */
     269/* static volatile void showSLA(facet &f); */
     270/* static bool isMonomial(const ideal &I); */
     271/* static bool ivAreEqual(const int64vec &a, const int64vec &b); */
     272/* static bool areEqual2(facet *f, facet *g); */
     273/* static bool areEqual( facet *f, facet *g); */
    274274// bool iv64isStrictlyPositive(int64vec *);
    275275#endif
  • dyn_modules/callgfanlib/gitfan.cc

    r6a6ae2 r32d8cb  
    4040    gfan::ZVector v = f.interiorPoint;
    4141    gfan::ZVector w = f.facetNormal;
    42     assume(c.ambientDimension() == v.size());
    43     assume(c.ambientDimension() == w.size());
     42    assume(c.ambientDimension() == (int)v.size());
     43    assume(c.ambientDimension() == (int)w.size());
    4444    assume(c.contains(v));
    4545    assume(!c.contains(w));
     
    5353  {
    5454#ifndef NDEBUG
    55     assume(c.ambientDimension() == v.size());
    56     assume(c.ambientDimension() == w.size());
     55    assume(c.ambientDimension() == (int)v.size());
     56    assume(c.ambientDimension() == (int)w.size());
    5757    assume(c.contains(v));
    5858    assume(!c.contains(w));
     
    6666    gfan::ZVector v = this->interiorPoint;
    6767    gfan::ZVector w = this->facetNormal;
    68     assume(c.ambientDimension() == v.size());
    69     assume(c.ambientDimension() == w.size());
     68    assume(c.ambientDimension() == (int)v.size());
     69    assume(c.ambientDimension() == (int)w.size());
    7070    assume(c.contains(v));
    7171    assume(!c.contains(w));
     
    114114    return F;
    115115
    116   int index = 0;
     116  // int index = 0;
    117117  /* next we iterate over each of the r facets, build the respective cone and add it to the list */
    118118  /* this is the i=0 case */
  • dyn_modules/callpolymake/Makefile.am

    r6a6ae2 r32d8cb  
    1010
    1111# forcefully enable exceptions for polymake
    12 POLYMAKE_CFLAGS = -fexceptions
     12POLYMAKE_CFLAGS = -fexceptions -frtti
    1313
    1414AM_LDFLAGS      = -release ${PACKAGE_VERSION} ${PM_LDFLAGS}
     
    1616SOURCES = polymake_conversion.cc polymake_documentation.cc polymake_wrapper.cc
    1717
     18CXXFLAGS += $(POLYMAKE_CXXFLAGS)
     19
    1820polymake_la_SOURCES = $(SOURCES)
    1921
    2022MYINCLUDES = -I${top_srcdir} -I${top_builddir} -I${srcdir} \
    21 -I${top_srcdir}/libpolys -I${top_builddir}/libpolys \
    22 $(GMP_CFLAGS) ${PM_INC} ${PM_CFLAGS} ${POLYMAKE_CFLAGS}
     23-I${top_srcdir}/libpolys -I${top_builddir}/libpolys  \
     24-I${top_builddir}/factory/include $(GMP_CFLAGS) $(PM_INC) $(PM_CFLAGS) \
     25$(POLYMAKE_CFLAGS) $(FACTORY_CFLAGS)
    2326
    2427P_PROCS_CPPFLAGS_COMMON = -DDYNAMIC_VERSION
  • dyn_modules/callpolymake/polymake_conversion.cc

    r6a6ae2 r32d8cb  
    77#include <polymake/Set.h>
    88#include <polymake/common/lattice_tools.h>
    9 // #include <polymake/perl/macros.h>
    10 // #include <polymake/IncidenceMatrix.h>
     9#include <polymake/IncidenceMatrix.h>
    1110
    1211#include <gfanlib/gfanlib.h>
     
    1413
    1514#include <kernel/mod2.h>
    16 // #include <kernel/structs.h>
    17 // #include <kernel/febase.h>
    1815#include <libpolys/misc/intvec.h>
    19 
    20 // #include <callgfanlib/bbcone.h>
    21 // #include <callgfanlib/bbfan.h>
    22 // #include <callgfanlib/bbpolytope.h>
    23 
    24 // #include <Singular/blackbox.h>
    25 // #include <Singular/ipshell.h>
    26 // #include <Singular/subexpr.h>
    27 // #include <Singular/tok.h>
    28 
     16#include <libpolys/coeffs/numbers.h>
     17#include <libpolys/coeffs/bigintmat.h>
     18#include <Singular/lists.h>
     19#include <Singular/ipid.h> // for bigints,
     20// is there really nothing better than this?
    2921
    3022/* Functions for converting Integers, Rationals and their Matrices
     
    136128}
    137129
     130number PmInteger2Number (const polymake::Integer& pi)
     131{
     132  mpz_class cache(pi.get_rep());
     133  long m = 268435456;
     134  if(mpz_cmp_si(cache.get_mpz_t(),m))
     135  {
     136    int temp = (int) mpz_get_si(cache.get_mpz_t());
     137    return n_Init(temp,coeffs_BIGINT);
     138  }
     139  else
     140    return n_InitMPZ(cache.get_mpz_t(),coeffs_BIGINT);
     141}
     142
    138143intvec* PmVectorInteger2Intvec (const polymake::Vector<polymake::Integer>* vi, bool &ok)
    139144{
     
    161166}
    162167
    163 // intvec* PmIncidenceMatrix2Intvec (polymake::IncidenceMatrix<polymake::NonSymmetric>* icmat)
    164 // {
    165 //   int rows = icmat->rows();
    166 //   int cols = icmat->cols();
    167 //   intvec* iv = new intvec(rows,cols,0);
    168 //   for (int r = 1; r <= rows; r++)
    169 //     for (int c = 1; c <= cols; c++)
    170 //       IMATELEM(*iv,r,c) = (int) (*icmat).row(r).exists(c);
    171 //   return iv;
    172 // }
     168bigintmat* PmMatrixInteger2Bigintmat (polymake::Matrix<polymake::Integer>* mi)
     169{
     170  int rows = mi->rows();
     171  int cols = mi->cols();
     172  bigintmat* bim= new bigintmat(rows,cols,coeffs_BIGINT);
     173  const polymake::Integer* pi = concat_rows(*mi).begin();
     174  for (int r = 1; r <= rows; r++)
     175    for (int c = 1; c <= cols; c++)
     176    {
     177      number temp = PmInteger2Number(*pi);
     178      bim->set(r,c,temp);
     179      n_Delete(&temp,coeffs_BIGINT);
     180      pi++;
     181    }
     182  return bim;
     183}
     184
     185lists PmIncidenceMatrix2ListOfIntvecs (polymake::IncidenceMatrix<polymake::NonSymmetric>* icmat)
     186{
     187  int rows = icmat->rows();
     188  int cols = icmat->cols();
     189  lists L = (lists)omAllocBin(slists_bin);
     190  L->Init(rows);
     191
     192  for (int r = 0; r < rows; r++)
     193  {
     194    intvec* iv = new intvec(cols); int i=0;
     195    for (int c = 0; c < cols; c++)
     196    {
     197      if ((*icmat).row(r).exists(c))
     198      { (*iv)[i]=c; i++; }
     199    }
     200    iv->resize(i);
     201    L->m[r].rtyp = INTVEC_CMD;
     202    L->m[r].data = (void*) iv;
     203  }
     204
     205  return L;
     206}
     207
     208lists PmAdjacencyMatrix2ListOfEdges (polymake::IncidenceMatrix<polymake::NonSymmetric>* icmat)
     209{
     210  int rows = icmat->rows();
     211  int cols = icmat->cols();
     212
     213  // counting number of edges
     214  int i=0; int r, c;
     215  for (r=0; r<rows; r++)
     216  {
     217    for (c=0; c<cols; c++)
     218    {
     219      if ((*icmat).row(r).exists(c) && r<c)
     220        i++;
     221    }
     222  }
     223
     224  lists L = (lists)omAllocBin(slists_bin);
     225  L->Init(i);
     226
     227  i=0;
     228  for (r=0; r<rows; r++)
     229  {
     230    for (c=0; c<cols; c++)
     231    {
     232      if ((*icmat).row(r).exists(c) && r<c)
     233      {
     234        intvec* iv = new intvec(2);
     235        (*iv)[0]=r; (*iv)[1]=c;
     236        L->m[i].rtyp = INTVEC_CMD;
     237        L->m[i].data = (void*) iv;
     238        i++;
     239      }
     240    }
     241  }
     242
     243  return L;
     244}
    173245
    174246intvec* PmSetInteger2Intvec (polymake::Set<polymake::Integer>* si, bool &b)
  • dyn_modules/callpolymake/polymake_conversion.h

    r6a6ae2 r32d8cb  
    33
    44#include <kernel/mod2.h>
    5 
    6 #ifdef HAVE_FANS
    75
    86#include <gmpxx.h>
     
    1412#include <polymake/Set.h>
    1513#include <polymake/common/lattice_tools.h>
     14#include <polymake/IncidenceMatrix.h>
    1615
    1716#include <gfanlib/gfanlib.h>
    1817#include <gfanlib/gfanlib_q.h>
    1918
     19#include <libpolys/coeffs/numbers.h>
     20#include <libpolys/coeffs/bigintmat.h>
    2021#include <libpolys/misc/intvec.h>
     22#include <Singular/lists.h>
    2123
    2224/* Functions for converting Integers, Rationals and their Matrices
     
    4345intvec* PmVectorInteger2Intvec (const polymake::Vector<polymake::Integer>* vi, bool &ok);
    4446intvec* PmMatrixInteger2Intvec (polymake::Matrix<polymake::Integer>* mi, bool &ok);
    45 // intvec* PmIncidenceMatrix2Intvec (polymake::IncidenceMatrix<polymake::NonSymmetric>* icmat);
     47lists PmIncidenceMatrix2ListOfIntvecs (polymake::IncidenceMatrix<polymake::NonSymmetric>* icmat);
     48lists PmAdjacencyMatrix2ListOfEdges (polymake::IncidenceMatrix<polymake::NonSymmetric>* icmat);
    4649intvec* PmSetInteger2Intvec (polymake::Set<polymake::Integer>* si, bool &b);
     50number PmInteger2Number (const polymake::Integer& pi);
     51bigintmat* PmMatrixInteger2Bigintmat (polymake::Matrix<polymake::Integer>* mi);
    4752
    4853/* polymake <- singular */
     
    6267
    6368#endif
    64 #endif
  • dyn_modules/callpolymake/polymake_documentation.cc

    r6a6ae2 r32d8cb  
    1 #include <polymake_conversion.h>
    2 
    3 #include <callgfanlib/bbcone.h>
    4 #include <callgfanlib/bbfan.h>
    5 #include <callgfanlib/bbpolytope.h>
    6 
    7 #include <Singular/blackbox.h>
    8 #include <Singular/ipshell.h>
    9 #include <Singular/subexpr.h>
    101#include <Singular/ipid.h>
    112
     
    204195    module_help_proc("polymake.so","normalFan", normalFan_help);
    205196
     197  const char* vertexAdjacencyGraph_help =
     198    "USAGE:    vertexAdjacencyGraph(polytope p)\nRETURN:   list,\nKEYWORDS: polytopes; polymake;\nEXAMPLE:  example visual shows an example\n";
     199
     200    module_help_proc("polymake.so","vertexAdjacencyGraph", normalFan_help);
     201
     202  const char* vertexEdgeGraph_help =
     203    "USAGE:    vertexEdgeGraph(polytope p)\nRETURN:   list,\nKEYWORDS: polytopes; polymake;\nEXAMPLE:  example visual shows an example\n";
     204
     205    module_help_proc("polymake.so","vertexEdgeGraph", normalFan_help);
     206
    206207}
  • dyn_modules/callpolymake/polymake_documentation.h

    r6a6ae2 r32d8cb  
    44#include <kernel/mod2.h>
    55
    6 #ifdef HAVE_FANS
    7 
    86#include <polymake_conversion.h>
    97
    10 #include <callgfanlib/bbcone.h>
    11 #include <callgfanlib/bbfan.h>
    12 #include <callgfanlib/bbpolytope.h>
     8#include <dyn_modules/callgfanlib/bbcone.h>
     9#include <dyn_modules/callgfanlib/bbfan.h>
     10#include <dyn_modules/callgfanlib/bbpolytope.h>
    1311
    1412#include <Singular/blackbox.h>
     
    2220
    2321#endif
    24 #endif
  • dyn_modules/callpolymake/polymake_wrapper.cc

    r6a6ae2 r32d8cb  
    11#include <polymake_conversion.h>
    22#include <polymake_documentation.h>
     3#include <polymake/Graph.h>
    34
    45#include <dyn_modules/callgfanlib/bbcone.h>
     
    16801681}
    16811682
     1683
     1684BOOLEAN PMvertexAdjacencyGraph(leftv res, leftv args)
     1685{
     1686  leftv u = args;
     1687  if ((u != NULL) && (u->Typ() == polytopeID))
     1688  {
     1689    gfan::ZCone* zp = (gfan::ZCone*) u->Data();
     1690    lists output=(lists)omAllocBin(slists_bin); output->Init(2);
     1691    try
     1692    {
     1693      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
     1694      polymake::Matrix<polymake::Integer> vert0 = p->give("VERTICES");
     1695      bigintmat* vert1 = PmMatrixInteger2Bigintmat(&vert0);
     1696      output->m[0].rtyp = BIGINTMAT_CMD;
     1697      output->m[0].data = (void*) vert1;
     1698
     1699      polymake::Graph<> gr=p->give("GRAPH.ADJACENCY");
     1700      polymake::IncidenceMatrix<polymake::NonSymmetric> adj = adjacency_matrix(gr);
     1701      lists listOfEdges = PmIncidenceMatrix2ListOfIntvecs(&adj);
     1702      output->m[1].rtyp = LIST_CMD;
     1703      output->m[1].data = (void*) listOfEdges;
     1704      delete p;
     1705    }
     1706    catch (const std::exception& ex)
     1707    {
     1708      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
     1709      return TRUE;
     1710    }
     1711    res->rtyp = LIST_CMD;
     1712    res->data = (void*) output;
     1713    return FALSE;
     1714  }
     1715  WerrorS("vertexEdgeGraph: unexpected parameters");
     1716  return TRUE;
     1717}
     1718
     1719
     1720BOOLEAN PMvertexEdgeGraph(leftv res, leftv args)
     1721{
     1722  leftv u = args;
     1723  if ((u != NULL) && (u->Typ() == polytopeID))
     1724  {
     1725    gfan::ZCone* zp = (gfan::ZCone*) u->Data();
     1726    lists output=(lists)omAllocBin(slists_bin); output->Init(2);
     1727    try
     1728    {
     1729      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
     1730      polymake::Matrix<polymake::Integer> vert0 = p->give("VERTICES");
     1731      bigintmat* vert1 = PmMatrixInteger2Bigintmat(&vert0);
     1732      output->m[0].rtyp = BIGINTMAT_CMD;
     1733      output->m[0].data = (void*) vert1;
     1734
     1735      polymake::Graph<> gr=p->give("GRAPH.ADJACENCY");
     1736      polymake::IncidenceMatrix<polymake::NonSymmetric> adj = adjacency_matrix(gr);
     1737      lists listOfEdges = PmAdjacencyMatrix2ListOfEdges(&adj);
     1738      output->m[1].rtyp = LIST_CMD;
     1739      output->m[1].data = (void*) listOfEdges;
     1740      delete p;
     1741    }
     1742    catch (const std::exception& ex)
     1743    {
     1744      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
     1745      return TRUE;
     1746    }
     1747    res->rtyp = LIST_CMD;
     1748    res->data = (void*) output;
     1749    return FALSE;
     1750  }
     1751  WerrorS("vertexEdgeGraph: unexpected parameters");
     1752  return TRUE;
     1753}
     1754
     1755
    16821756extern "C" int mod_init(SModulFunctions* p)
    16831757{
     
    16851759    {init_polymake = new polymake::Main();}
    16861760  init_polymake->set_application("fan");
    1687   // iiAddCproc("","cube",FALSE,cube);
    1688   // iiAddCproc("","cross",FALSE,cross);
    1689   //p->iiAddCproc("polymake.so","coneViaPoints",FALSE,PMconeViaRays);
    1690   p->iiAddCproc("polymake.so","polytopeViaVertices",FALSE,PMpolytopeViaVertices);
     1761  // p->iiAddCproc("polymake.so","coneViaPoints",FALSE,PMconeViaRays);
     1762  // p->iiAddCproc("polymake.so","polytopeViaPoints",FALSE,PMpolytopeViaVertices);
    16911763  p->iiAddCproc("polymake.so","isLatticePolytope",FALSE,PMisLatticePolytope);
    16921764  p->iiAddCproc("polymake.so","isBounded",FALSE,PMisBounded);
     
    17021774  p->iiAddCproc("polymake.so","latticeCodegree",FALSE,PMlatticeCodegree);
    17031775  p->iiAddCproc("polymake.so","ehrhartPolynomialCoeff",FALSE,PMehrhartPolynomialCoeff);
    1704   //p->iiAddCproc("polymake.so","fVector",FALSE,PMfVector);
     1776  p->iiAddCproc("polymake.so","fVector",FALSE,PMfVector);
    17051777  p->iiAddCproc("polymake.so","hVector",FALSE,PMhVector);
    17061778  p->iiAddCproc("polymake.so","hStarVector",FALSE,PMhStarVector);
     
    17271799  p->iiAddCproc("polymake.so","visual",FALSE,visual);
    17281800  p->iiAddCproc("polymake.so","normalFan",FALSE,normalFan);
    1729   // iiAddCproc("","testingtypes",FALSE,testingtypes);
    1730   // iiAddCproc("","testingintvec",FALSE,testingintvec);
    1731   // iiAddCproc("","testingcones",FALSE,testingcones);
    1732   // iiAddCproc("","testingpolytopes",FALSE,testingpolytopes);
    1733   // iiAddCproc("","testingfans",FALSE,testingfans);
    1734   // iiAddCproc("","testingvisuals",FALSE,testingvisuals);
    1735   // iiAddCproc("","testingstrings",FALSE,testingstrings);
    1736   // iiAddCproc("","testingmatrices",FALSE,testingmatrices);
    1737   // iiAddCproc("","loadPolymakeDocumentation",FALSE,loadPolymakeDocumentation);
     1801  p->iiAddCproc("polymake.so","vertexAdjacencyGraph",FALSE,PMvertexAdjacencyGraph);
     1802  p->iiAddCproc("polymake.so","vertexEdgeGraph",FALSE,PMvertexEdgeGraph);
    17381803
    17391804  blackbox* b=getBlackboxStuff(polytopeID);
  • gfanlib/gfanlib_matrix.h

    r6a6ae2 r32d8cb  
    6969  void appendRow(Vector<typ> const &v)
    7070    {
    71       assert(v.size()==width);
     71      assert((int)v.size()==width);
    7272      rows.push_back(v);
    7373      height++;
     
    410410  {
    411411    assert(typ::isField());
    412     assert(v.size()==getWidth());
     412    assert((int)v.size()==getWidth());
    413413
    414414    int pivotI=-1;
  • gfanlib/gfanlib_polyhedralfan.cpp

    r6a6ae2 r32d8cb  
    352352
    353353      bool notAll=false;
    354       for(int j=0;j<theCone.indices.size();j++)
     354      for(unsigned j=0;j<theCone.indices.size();j++)
    355355        if(dot(rays[theCone.indices[j]],facetCandidates[i]).sign()==0)
    356356          indices.insert(theCone.indices[j]);
     
    395395void addFacesToSymmetricComplex(SymmetricComplex &c, ZCone const &cone, ZMatrix const &facetCandidates, ZMatrix const &generatorsOfLinealitySpace)
    396396{
    397   ZMatrix const &rays=c.getVertices();
     397  // ZMatrix const &rays=c.getVertices();
    398398  std::set<int> indices;
    399399
     
    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{
  • gfanlib/gfanlib_polymakefile.cpp

    r6a6ae2 r32d8cb  
    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");
     
    6666namespace gfan{
    6767PolymakeProperty::PolymakeProperty(const std::string &name_, const std::string &value_):
    68   name(name_),
    69   value(value_)
     68  value(value_),
     69  name(name_)
    7070{
    7171}
     
    271271
    272272
    273 bool PolymakeFile::readBooleanProperty(const char *p)
     273bool PolymakeFile::readBooleanProperty(const char */*p*/)
    274274{
    275275  return false;
     
    277277
    278278
    279 void PolymakeFile::writeBooleanProperty(const char *p, bool n)
     279void PolymakeFile::writeBooleanProperty(const char */*p*/, bool /*n*/)
    280280{
    281281}
     
    322322  stringstream t;
    323323
    324   if(comments)assert(comments->size()>=m.getHeight());
     324  if(comments)assert((int)comments->size()>=m.getHeight());
    325325  if(isXml)
    326326    {
     
    389389    {
    390390      t<<"<incidence_matrix>";
    391       for(int i=0;i<m.size();i++)
     391      for(unsigned i=0;i<m.size();i++)
    392392        {
    393393          t<<"<set>";
     
    405405  else
    406406    {
    407       for(int i=0;i<m.size();i++)
     407      for(unsigned i=0;i<m.size();i++)
    408408        {
    409409          t<<'{';
     
    445445    {
    446446      t<<"<vector>";
    447       for(int i=0;i<v.size();i++)
     447      for(unsigned i=0;i<v.size();i++)
    448448        {
    449449          if(i!=0)t<<" ";
     
    454454  else
    455455    {
    456       for(int i=0;i<v.size();i++)
     456      for(unsigned i=0;i<v.size();i++)
    457457        {
    458458          if(i!=0)t<<" ";
  • gfanlib/gfanlib_q.h

    r6a6ae2 r32d8cb  
    156156    return mpq_sgn(value);
    157157  }
    158   static Rational gcd(Rational const &a, Rational const &b, Rational &s, Rational &t)
     158  static Rational gcd(Rational const &a, Rational const /*&b*/, Rational /*&s*/, Rational /*t*/)
    159159  {
    160160/*    mpz_t r;
  • gfanlib/gfanlib_symmetriccomplex.cpp

    r6a6ae2 r32d8cb  
    1515
    1616SymmetricComplex::Cone::Cone(std::set<int> const &indices_, int dimension_, Integer multiplicity_, bool sortWithSymmetry, SymmetricComplex const &complex):
     17  isKnownToBeNonMaximalFlag(false),
    1718  dimension(dimension_),
    1819  multiplicity(multiplicity_),
    19   isKnownToBeNonMaximalFlag(false),
    2020  sortKeyPermutation(complex.n)
    2121{
     
    2727  ZMatrix const &vertices=complex.getVertices();
    2828  ZVector sum(vertices.getWidth());
    29   for(int i=0;i<indices.size();i++)
     29  for(unsigned i=0;i<indices.size();i++)
    3030    sum+=vertices[indices[i]];
    3131
     
    5656  ZMatrix const &vertices=complex.getVertices();
    5757  ZVector sum(vertices.getWidth());
    58   for(int i=0;i<indices.size();i++)
     58  for(unsigned i=0;i<indices.size();i++)
    5959    sum+=vertices[indices[i]];
    6060
     
    6262  Permutation const &bestPermutation=sortKeyPermutation;
    6363
    64   assert(bestPermutation.size()==n);
     64  assert((int)bestPermutation.size()==n);
    6565
    6666  IntVector indicesNew(indices.size());
    6767  int I=0;
    68   for(int i=0;i<indices.size();i++,I++)
     68  for(unsigned i=0;i<indices.size();i++,I++)
    6969    {
    7070      ZVector ny=bestPermutation.apply(complex.vertices[indices[i]]);
     
    8080{
    8181  std::set<int> ret;
    82   for(int i=0;i<indices.size();i++)
     82  for(unsigned i=0;i<indices.size();i++)
    8383    ret.insert(indices[i]);
    8484
     
    8989{
    9090  int next=0;
    91   for(int i=0;i<indices.size();i++)
     91  for(unsigned i=0;i<indices.size();i++)
    9292    {
    9393      while(1)
    9494        {
    95           if(next>=c.indices.size())return false;
     95          if(next>=(int)c.indices.size())return false;
    9696          if(indices[i]==c.indices[next])break;
    9797          next++;
     
    105105{
    106106  std::set<int> r;
    107   for(int i=0;i<indices.size();i++)
     107  for(unsigned i=0;i<indices.size();i++)
    108108    {
    109109      ZVector ny=permutation.apply(complex.vertices[indices[i]]);
     
    139139{
    140140  ZMatrix l;
    141   for(int i=0;i<indices.size();i++)
     141  for(unsigned i=0;i<indices.size();i++)
    142142    l.appendRow(complex.vertices[indices[i]]);
    143143
     
    150150SymmetricComplex::SymmetricComplex(ZMatrix const &rays, ZMatrix const &linealitySpace_, SymmetryGroup const &sym_):
    151151  n(rays.getWidth()),
     152  linealitySpace(canonicalizeSubspace(linealitySpace_)),
    152153  sym(sym_),
    153   dimension(-1),
    154   linealitySpace(canonicalizeSubspace(linealitySpace_))
     154  dimension(-1)
    155155{
    156156  assert(rays.getWidth()==linealitySpace.getWidth());
     
    222222}
    223223
    224 /*
     224#if 0
    225225IntVector SymmetricComplex::dimensionsAtInfinity()const
    226226{
     
    228228     dimension of the intersection of each cone in the complex with
    229229     the plane x_0=0 */
    230 /*
    231230  IntVector ret(cones.size());
    232231
     
    247246  return ret;
    248247}
    249 */
     248#endif
    250249
    251250void SymmetricComplex::buildConeLists(bool onlyMaximal, bool compressed, std::vector<std::vector<IntVector > >*conelist/*, ZMatrix *multiplicities*/)const
     
    259258      int numberOfOrbitsOutput=0;
    260259      int numberOfOrbitsOfThisDimension=0;
    261       bool newDimension=true;
     260      // bool newDimension=true;
    262261        {
    263262          int I=0;
    264263          for(ConeContainer::const_iterator i=cones.begin();i!=cones.end();i++,I++)
    265                   if(i->dimension==d)
    266                     {
    267                   numberOfOrbitsOfThisDimension++;
     264            if(i->dimension==d)
     265            {
     266              numberOfOrbitsOfThisDimension++;
    268267              if(!onlyMaximal || isMaximal(*i))
    269268                {
    270269                  numberOfOrbitsOutput++;
    271                   bool isMax=isMaximal(*i);
    272                   bool newOrbit=true;
     270                  // bool isMax=isMaximal(*i);
     271                  // bool newOrbit=true;
    273272                  std::set<std::set<int> > temp;
    274                     for(SymmetryGroup::ElementContainer::const_iterator k=sym.elements.begin();k!=sym.elements.end();k++)
    275                       {
     273                  for(SymmetryGroup::ElementContainer::const_iterator k=sym.elements.begin();k!=sym.elements.end();k++)
     274                    {
    276275                        Cone temp1=i->permuted(*k,*this,false);
    277276                        temp.insert(temp1.indexSet());
     
    291290                          *multiplicities << std::endl;
    292291                        }*/
    293                       newOrbit=false;
    294                       newDimension=false;
     292                      // newOrbit=false;
     293                      // newDimension=false;
    295294                    }
    296               }
    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
     295                }
     296            }
     297        }
     298    }
     299
     300}
     301
     302std::string SymmetricComplex::toStringJustCones(int dimLow, int dimHigh, bool onlyMaximal, bool group, std::ostream *multiplicities, bool compressed, bool /*tPlaneSort*/)const
    304303{
    305304  std::stringstream ret;
     
    392391        {
    393392          bool isBounded=true;
    394           for(int j=0;j<i->indices.size();j++)
     393          for(unsigned j=0;j<i->indices.size();j++)
    395394            if(vertices[i->indices[j]][0].sign()==0)isBounded=false;
    396395          doAdd=isBounded;
     
    692691  {
    693692    ZMatrix generators(indices.size(),getAmbientDimension());
    694     for(int i=0;i<indices.size();i++)
     693    for(unsigned i=0;i<indices.size();i++)
    695694      generators[i]=vertices[indices[i]];
    696695    return ZCone::givenByRays(generators,linealitySpace);
  • gfanlib/gfanlib_symmetry.cpp

    r6a6ae2 r32d8cb  
    2525                TrieNode(IntVector const &v, int i)
    2626                {
    27                         if(i<v.size())
     27                  if(i<(int)v.size())
    2828                        m[v[i]]=TrieNode(v,i+1);
    2929                }
     
    3131                {
    3232                  int ret=0;
    33                   if(i==v.size())return 1;
     33                  if(i==(int)v.size())return 1;
    3434                  for(Map::const_iterator j=m.begin();j!=m.end();j++)
    3535                    {
     
    4141                void search(ZVector const &v, ZVector  &building, Permutation &tempPerm, Permutation &ret, ZVector &optimal, int i, bool &isImproving)const
    4242                {
    43                         if(i==v.size()){ret=tempPerm;optimal=building;isImproving=false;return;}
     43                  if(i==(int)v.size()){ret=tempPerm;optimal=building;isImproving=false;return;}
    4444                        if(isImproving)
    4545                                building[i]=-0x7fffffff;
     
    6161                void searchStabalizer(ZVector const &v, ZVector  &building, Permutation &tempPerm, Permutation &ret, ZVector &optimal, int i, bool &isImproving, ZVector const &toBeFixed)const
    6262                {
    63                         if(i==v.size())
     63                  if(i==(int)v.size())
    6464                                if(!(tempPerm.apply(v)<optimal))
    6565                                        {
     
    102102                void insert(Permutation const &v, int i)
    103103                {
    104                         if(i==v.size())return;
     104                  if(i==(int)v.size())return;
    105105                        if(m.count(v[i]))
    106106                                m[v[i]].insert(v,i+1);
     
    132132        int n;
    133133        Trie(int n_):
    134                 n(n_),
    135                 theTree(Permutation(n_),0)
     134                theTree(Permutation(n_),0),
     135                n(n_)
    136136        {
    137137        }
     
    276276  IntVector ret(size());
    277277  assert(size()==b.size());
    278   for(int i=0;i<size();i++)ret[i]=b[(*this)[i]];
     278  for(unsigned i=0;i<size();i++)ret[i]=b[(*this)[i]];
    279279  return Permutation(ret);
    280280}
     
    284284  IntVector ret(size());
    285285  assert(size()==b.size());
    286   for(int i=0;i<size();i++)ret[(*this)[i]]=b[i];
     286  for(unsigned i=0;i<size();i++)ret[(*this)[i]]=b[i];
    287287  return Permutation(ret);
    288288}
     
    292292  IntVector ret(size());
    293293  assert(size()==v.size());
    294   for(int i=0;i<size();i++)ret[i]=v[(*this)[i]];
     294  for(unsigned i=0;i<size();i++)ret[i]=v[(*this)[i]];
    295295  return ret;
    296296}
     
    300300  ZVector ret(size());
    301301  assert(size()==v.size());
    302   for(int i=0;i<size();i++)ret[i]=v[(*this)[i]];
     302  for(unsigned i=0;i<size();i++)ret[i]=v[(*this)[i]];
    303303  return ret;
    304304}
     
    309309  ZVector ret(size());
    310310  assert(size()==v.size());
    311   for(int i=0;i<size();i++)ret[(*this)[i]]=v[i];
     311  for(unsigned i=0;i<size();i++)ret[(*this)[i]]=v[i];
    312312  return ret;
    313313}
     
    431431ZVector Permutation::fundamentalDomainInequality()const
    432432{
    433   for(int i=0;i<size();i++)
    434     if((*this)[i]!=i)
     433  for(unsigned i=0;i<size();i++)
     434    if((*this)[i]!=(int)i)
    435435      return ZVector::standardVector(size(),i)-ZVector::standardVector(size(),(*this)[i]);
    436436  return ZVector(size());
  • gfanlib/gfanlib_vector.h

    r6a6ae2 r32d8cb  
    101101      if(size()<b.size())return true;
    102102      if(size()>b.size())return false;
    103       for(int i=0;i<size();i++)
     103      for(unsigned i=0;i<size();i++)
    104104        {
    105105          if(v[i]<b[i])return true;
     
    156156      return pq*pq==pp*qq;
    157157*/
    158           int n=p.size();
     158          unsigned n=p.size();
    159159          assert(n==q.size());
    160           int i;
     160          unsigned i;
    161161          for(i=0;i<n;i++)
    162162          {
     
    167167          typ a=p.v[i];
    168168          typ b=q.v[i];
    169           for(int j=0;j<n;j++)
     169          for(unsigned j=0;j<n;j++)
    170170            if(a*q.v[j]!=b*p.v[j])return false;
    171171          return true;
     
    175175  // Arithmetic slow
    176176  //-----------------
    177   inline friend Vector operator*(typ s, const Vector& q){Vector p=q;for(int i=0;i<q.size();i++)p[i]*=s;return p;}
     177  inline friend Vector operator*(typ s, const Vector& q){Vector p=q;for(unsigned i=0;i<q.size();i++)p[i]*=s;return p;}
    178178//  inline friend Vektor operator/(const Vektor& q, typ s){Vektor p=q;for(int i=0;i<q.size();i++)p[i]/=s;return p;}
    179179/*  inline friend Vector operator*(const Vektor& p, const Vektor& q){assert(p.size()==q.size());Vektor p1=p;for(int i=0;i<p.size();i++)p1.v[i]*=q.v[i];return p1;}
     
    181181*/
    182182  inline friend Vector operator/(const Vector& p, typ const &s){Vector ret(p.size());for(unsigned i=0;i<p.size();i++)ret[i]=p[i]/s;return ret;}
    183   inline friend Vector operator+(const Vector& p, const Vector& q){assert(p.size()==q.size());Vector p1=p;for(int i=0;i<p.size();i++)p1[i]+=q[i];return p1;}
    184   inline friend Vector operator-(const Vector& p, const Vector& q){assert(p.size()==q.size());Vector p1=p;for(int i=0;i<p.size();i++)p1[i]-=q[i];return p1;}
    185   inline friend Vector max(const Vector& p, const Vector& q){assert(p.size()==q.size());Vector p1=p;for(int i=0;i<p.size();i++)if(p1[i]<q[i])p1[i]=q[i];return p1;}
    186   inline friend Vector min(const Vector& p, const Vector& q){assert(p.size()==q.size());Vector p1=p;for(int i=0;i<p.size();i++)if(p1[i]>q[i])p1[i]=q[i];return p1;}
     183  inline friend Vector operator+(const Vector& p, const Vector& q){assert(p.size()==q.size());Vector p1=p;for(unsigned i=0;i<p.size();i++)p1[i]+=q[i];return p1;}
     184  inline friend Vector operator-(const Vector& p, const Vector& q){assert(p.size()==q.size());Vector p1=p;for(unsigned i=0;i<p.size();i++)p1[i]-=q[i];return p1;}
     185  inline friend Vector max(const Vector& p, const Vector& q){assert(p.size()==q.size());Vector p1=p;for(unsigned i=0;i<p.size();i++)if(p1[i]<q[i])p1[i]=q[i];return p1;}
     186  inline friend Vector min(const Vector& p, const Vector& q){assert(p.size()==q.size());Vector p1=p;for(unsigned i=0;i<p.size();i++)if(p1[i]>q[i])p1[i]=q[i];return p1;}
    187187
    188188  friend Vector operator-(const Vector &b)
    189189  {
    190190    Vector ret(b.size());
    191     for(int i=0;i<b.size();i++)ret[i]=-b[i];
     191    for(unsigned i=0;i<b.size();i++)ret[i]=-b[i];
    192192    return ret;
    193193  }
     
    226226    {
    227227      assert(begin>=0);
    228       assert(end<=size());
     228      assert(end<=(int)size());
    229229      assert(end>=begin);
    230230      Vector ret(end-begin);
     
    293293    typ temp1,temp2;
    294294    typ ret(1);
    295     for(int i=0;i<size();i++)
     295    for(unsigned i=0;i<size();i++)
    296296      ret=typ::gcd(ret,v[i],temp1,temp2);
    297297    return ret;
  • gfanlib/gfanlib_zcone.cpp

    r6a6ae2 r32d8cb  
    4444    dd_colrange d_input,j;
    4545    dd_RepresentationType rep=dd_Inequality;
    46     dd_boolean found=dd_FALSE, newformat=dd_FALSE, successful=dd_FALSE;
    47     char command[dd_linelenmax], comsave[dd_linelenmax];
     46    // dd_boolean found=dd_FALSE, newformat=dd_FALSE, successful=dd_FALSE;
     47    // char command[dd_linelenmax], comsave[dd_linelenmax];
    4848    dd_NumberType NT;
    4949
    5050    (*Error)=dd_NoError;
    5151
    52     rep=dd_Inequality; newformat=dd_TRUE;
     52    rep=dd_Inequality; // newformat=dd_TRUE;
    5353
    5454    m_input=g.getHeight();
     
    7070    }
    7171
    72     successful=dd_TRUE;
     72    // successful=dd_TRUE;
    7373
    7474    return M;
     
    108108  {
    109109    bool ret;
    110     dd_MatrixPtr M=NULL,M2=NULL,M3=NULL;
    111     dd_colrange d;
     110    dd_MatrixPtr M=NULL/*,M2=NULL,M3=NULL*/;
     111    // dd_colrange d;
    112112    dd_ErrorType err=dd_NoError;
    113     dd_rowset redrows,linrows,ignoredrows, basisrows;
    114     dd_colset ignoredcols, basiscols;
    115     dd_DataFileType inputfile;
    116     FILE *reading=NULL;
     113    // dd_rowset redrows,linrows,ignoredrows, basisrows;
     114    // dd_colset ignoredcols, basiscols;
     115    // dd_DataFileType inputfile;
     116    // FILE *reading=NULL;
    117117
    118118    cddinitGmp();
     
    121121    if (err!=dd_NoError) goto _L99;
    122122
    123     d=M->colsize;
     123    // d=M->colsize;
    124124
    125125    static dd_Arow temp;
     
    339339    if(numberOfRows==0)return;//the full space, so description is already irredundant
    340340
    341     dd_rowset r=NULL;
     341    // dd_rowset r=NULL;
    342342    ZMatrix g=inequalities;
    343343    g.append(equations);
    344344
    345     dd_LPSolverType solver=dd_DualSimplex;
     345    // dd_LPSolverType solver=dd_DualSimplex;
    346346    dd_MatrixPtr A=NULL;
    347347    dd_ErrorType err=dd_NoError;
     
    402402    int numberOfRows=numberOfEqualities+numberOfInequalities;
    403403
    404     dd_rowset r=NULL;
     404    // dd_rowset r=NULL;
    405405    ZMatrix g=inequalities;
    406406    g.append(equations);
     
    448448  void dual(ZMatrix const &inequalities, ZMatrix const &equations, ZMatrix &dualInequalities, ZMatrix &dualEquations)
    449449  {
    450     int result;
     450    // int result;
    451451
    452452    dd_MatrixPtr A=NULL;
     
    472472
    473473    return;
    474    _L99:
    475     assert(0);
     474   // _L99:
     475   // assert(0);
    476476  }
    477477  // this procedure is take from cddio.c.
     
    556556    int dim2=inequalities.getHeight();
    557557    if(dim2==0)return std::vector<std::vector<int> >();
    558     int dimension=inequalities.getWidth();
     558    // int dimension=inequalities.getWidth();
    559559
    560560    dd_MatrixPtr A=NULL;
     
    603603
    604604    return ret;
    605    _L99:
    606     assert(0);
    607     return std::vector<std::vector<int> >();
     605   // _L99:
     606   // assert(0);
     607   // return std::vector<std::vector<int> >();
    608608  }
    609609
     
    707707          inequalities=LpSolver::fastNormals(inequalities2);
    708708          goto noFallBack;
    709         fallBack://alternativ (disabled)
    710           lpSolver.removeRedundantRows(inequalities,equations,true);
     709        // fallBack://alternativ (disabled)
     710        //   lpSolver.removeRedundantRows(inequalities,equations,true);
    711711        noFallBack:;
    712712        }
     
    730730}
    731731
    732 std::ostream &operator<<(std::ostream &f, ZCone const &c)
     732void operator<<(std::ostream &f, ZCone const &c)
    733733{
    734734  f<<"Ambient dimension:"<<c.n<<std::endl;
     
    741741
    742742ZCone::ZCone(int ambientDimension):
     743  preassumptions(PCP_impliedEquationsKnown|PCP_facetsKnown),
     744  state(1),
     745  n(ambientDimension),
     746  multiplicity(1),
     747  linearForms(ZMatrix(0,ambientDimension)),
    743748  inequalities(ZMatrix(0,ambientDimension)),
    744749  equations(ZMatrix(0,ambientDimension)),
    745   n(ambientDimension),
    746   state(1),
    747   preassumptions(PCP_impliedEquationsKnown|PCP_facetsKnown),
     750  haveExtremeRaysBeenCached(false)
     751{
     752}
     753
     754
     755ZCone::ZCone(ZMatrix const &inequalities_, ZMatrix const &equations_, int preassumptions_):
     756  preassumptions(preassumptions_),
     757  state(0),
     758  n(inequalities_.getWidth()),
    748759  multiplicity(1),
    749   haveExtremeRaysBeenCached(false),
    750   linearForms(ZMatrix(0,ambientDimension))
    751 {
    752 }
    753 
    754 
    755 ZCone::ZCone(ZMatrix const &inequalities_, ZMatrix const &equations_, int preassumptions_):
     760  linearForms(ZMatrix(0,inequalities_.getWidth())),
    756761  inequalities(inequalities_),
    757762  equations(equations_),
    758   state(0),
    759   preassumptions(preassumptions_),
    760   multiplicity(1),
    761   haveExtremeRaysBeenCached(false),
    762   n(inequalities_.getWidth()),
    763   linearForms(ZMatrix(0,inequalities_.getWidth()))
     763  haveExtremeRaysBeenCached(false)
    764764  {
    765765  assert(preassumptions_<4);//OTHERWISE WE ARE DOING SOMETHING STUPID LIKE SPECIFYING AMBIENT DIMENSION
     
    10421042  std::vector<std::vector<int> > indices=lpSolver.extremeRaysInequalityIndices(inequalities);
    10431043
    1044   for(int i=0;i<indices.size();i++)
     1044  for(unsigned i=0;i<indices.size();i++)
    10451045    {
    10461046      /* At this point we know lineality space, implied equations and
     
    10821082
    10831083          std::vector<int> asVector(inequalities.getHeight());
    1084           for(int j=0;j<indices[i].size();j++){asVector[indices[i][j]]=1;}
     1084          for(unsigned j=0;j<indices[i].size();j++){asVector[indices[i][j]]=1;}
    10851085          ZMatrix equations=this->equations;
    10861086          ZVector theInequality;
    10871087
    1088           for(int j=0;j<asVector.size();j++)
     1088          for(unsigned j=0;j<asVector.size();j++)
    10891089            if(asVector[j])
    10901090              equations.appendRow(inequalities[j]);
     
    12291229ZCone ZCone::faceContaining(ZVector const &v)const
    12301230{
    1231   assert(n==v.size());
     1231  assert(n==(int)v.size());
    12321232  assert(contains(v));
    12331233  ZMatrix newEquations=equations;
  • gfanlib/gfanlib_zcone.h

    r6a6ae2 r32d8cb  
    352352     */
    353353   // PolyhedralCone projection(int newn)const;
    354     friend std::ostream &operator<<(std::ostream &f, ZCone const &c);
     354    friend void operator<<(std::ostream &f, ZCone const &c);
    355355};
    356356
  • gfanlib/gfanlib_zfan.cpp

    r6a6ae2 r32d8cb  
    1616  {
    1717    assert(dimension>=0);
    18     if(dimension>=T.size())return 0;
     18    if(dimension>=(int)T.size())return 0;
    1919    return T[dimension].size();
    2020  }
     
    162162
    163163//        log2 cerr<< "Number of orbits to expand "<<cones.size()<<endl;
    164         for(int i=0;i<cones.size();i++)
     164        for(unsigned i=0;i<cones.size();i++)
    165165        //  if(coneIndices==0 || coneIndices->count(i))
    166166            {
     
    202202  }
    203203  ZFan::ZFan(ZFan const& f):
     204    coneCollection(0),
    204205    complex(0),
    205     coneCollection(0),
    206206    cones(f.table(0,0)),
    207207    maximalCones(f.table(0,1)),
  • m4/flags.m4

    r6a6ae2 r32d8cb  
    8787 AC_LANG_PUSH([C++])
    8888 AX_APPEND_COMPILE_FLAGS(${FLAGS}, [CXXFLAGS])
     89 AX_APPEND_COMPILE_FLAGS([-fexceptions -frtti], [POLYMAKE_CXXFLAGS])
    8990 AC_LANG_POP([C++])
    9091
    9192 AX_APPEND_LINK_FLAGS(${FLAGS})
    92  
     93
     94 AC_SUBST(POLYMAKE_CXXFLAGS)
     95
    9396 if test "x${ENABLE_DEBUG}" == xyes; then
    9497  DBGFLAGS="-g -ftrapv -fdiagnostics-show-option -Wall -Wextra"
     
    121124 fi
    122125
    123 
    124126# SING_SHOW_FLAGS([before PROG_C_CC])
    125127
Note: See TracChangeset for help on using the changeset viewer.