source: git/Singular/dyn_modules/polymake/polymake_wrapper.cc @ aa4d31

spielwiese
Last change on this file since aa4d31 was aa4d31, checked in by Reimer Behrends <behrends@…>, 5 years ago
parallel preprocessor-related fixes.
  • Property mode set to 100644
File size: 56.1 KB
Line 
1#include "kernel/mod2.h"
2
3#ifdef HAVE_POLYMAKE
4
5#include "Singular/dyn_modules/gfanlib/bbcone.h"
6#include "Singular/dyn_modules/gfanlib/bbfan.h"
7#include "Singular/dyn_modules/gfanlib/bbpolytope.h"
8
9#include "Singular/blackbox.h"
10#include "Singular/ipshell.h"
11#include "Singular/subexpr.h"
12#include "Singular/mod_lib.h"
13
14#include <polymake_conversion.h>
15#include <polymake_documentation.h>
16#include <polymake/Graph.h>
17
18polymake::Main* init_polymake=NULL;
19
20static BOOLEAN bbpolytope_Op2(int op, leftv res, leftv i1, leftv i2)
21{
22  gfan::ZCone* zp = (gfan::ZCone*) i1->Data();
23  switch(op)
24  {
25    case '+':
26    {
27      if (i2->Typ()==polytopeID || i2->Typ()==coneID)
28      {
29        gfan::initializeCddlibIfRequired();
30        gfan::ZCone* zq = (gfan::ZCone*) i2->Data();
31        gfan::ZCone* ms;
32        try
33        {
34          polymake::perl::Object* pp = ZPolytope2PmPolytope(zp);
35          polymake::perl::Object* pq = ZPolytope2PmPolytope(zq);
36          polymake::perl::Object pms;
37          CallPolymakeFunction("minkowski_sum", *pp, *pq) >> pms;
38          ms = PmPolytope2ZPolytope(&pms);
39          delete pp;
40          delete pq;
41        }
42        catch (const std::exception& ex)
43        {
44          gfan::deinitializeCddlibIfRequired();
45          WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
46          return TRUE;
47        }
48        gfan::deinitializeCddlibIfRequired();
49        res->rtyp = polytopeID;
50        res->data = (void*) ms;
51        return FALSE;
52      }
53      return blackboxDefaultOp2(op,res,i1,i2);
54    }
55    case '*':
56    {
57      if (i2->Typ()==INT_CMD)
58      {
59        gfan::initializeCddlibIfRequired();
60        int s = (int)(long) i2->Data();
61        gfan::ZMatrix zm = zp->extremeRays();
62        for (int i=0; i<zm.getHeight(); i++)
63          for (int j=1; j<zm.getWidth(); j++)
64            zm[i][j] *= s;
65        gfan::ZCone* zs = new gfan::ZCone();
66        *zs = gfan::ZCone::givenByRays(zm,gfan::ZMatrix(0, zm.getWidth()));
67        gfan::deinitializeCddlibIfRequired();
68        res->rtyp = polytopeID;
69        res->data = (void*) zs;
70        return FALSE;
71      }
72      return blackboxDefaultOp2(op,res,i1,i2);
73    }
74    case '&':
75    {
76      if (i2->Typ()==polytopeID)
77      {
78        gfan::initializeCddlibIfRequired();
79        gfan::ZCone* zq = (gfan::ZCone*) i2->Data();
80        int d1 = zp->ambientDimension();
81        int d2 = zq->ambientDimension();
82        if (d1 != d2)
83        {
84          gfan::deinitializeCddlibIfRequired();
85          WerrorS("mismatching ambient dimensions");
86          return TRUE;
87        }
88        gfan::ZCone* zs = new gfan::ZCone();
89        *zs = gfan::intersection(*zp, *zq);
90        zs->canonicalize();
91        gfan::deinitializeCddlibIfRequired();
92        res->rtyp = polytopeID;
93        res->data = (void*) zs;
94        return FALSE;
95      }
96      return blackboxDefaultOp2(op,res,i1,i2);
97    }
98    case '|':
99    {
100      if(i2->Typ()==polytopeID)
101      {
102        gfan::initializeCddlibIfRequired();
103        gfan::ZCone* zq = (gfan::ZCone*) i2->Data();
104        int d1 = zp->ambientDimension();
105        int d2 = zq->ambientDimension();
106        if (d1 != d2)
107        {
108          gfan::deinitializeCddlibIfRequired();
109          WerrorS("mismatching ambient dimensions");
110          return TRUE;
111        }
112        gfan::ZMatrix rays = zp->extremeRays();
113        rays.append(zq->extremeRays());
114        gfan::ZMatrix lineality = zp->generatorsOfLinealitySpace();
115        lineality.append(zq->generatorsOfLinealitySpace());
116        gfan::ZCone* zs = new gfan::ZCone();
117        *zs = gfan::ZCone::givenByRays(rays,lineality);
118        zs->canonicalize();
119        gfan::deinitializeCddlibIfRequired();
120        res->rtyp = polytopeID;
121        res->data = (void*) zs;
122        return FALSE;
123      }
124    return blackboxDefaultOp2(op,res,i1,i2);
125    }
126    case EQUAL_EQUAL:
127    {
128      if(i2->Typ()==polytopeID)
129      {
130        gfan::initializeCddlibIfRequired();
131        gfan::ZCone* zq = (gfan::ZCone*) i2->Data();
132        zp->canonicalize();
133        zq->canonicalize();
134        bool b = !((*zp)!=(*zq));
135        gfan::deinitializeCddlibIfRequired();
136        res->rtyp = INT_CMD;
137        res->data = (char*) (long) b;
138        return FALSE;
139      }
140      return blackboxDefaultOp2(op,res,i1,i2);
141    }
142    default:
143      return blackboxDefaultOp2(op,res,i1,i2);
144  }
145  return blackboxDefaultOp2(op,res,i1,i2);
146}
147
148
149/* Functions for using Polymake in Singular */
150
151// BOOLEAN cube(leftv res, leftv args)
152// {
153//   leftv u = args;
154//   if ((u !=NULL) && (u->Typ() == INT_CMD))
155//     {
156//       int ambientDim = (int)(long)u->Data();
157//       if (ambientDim < 0)
158//      {
159//           Werror("expected non-negative ambient dim but got %d", ambientDim);
160//        return TRUE;
161//      }
162//       gfan::ZMatrix zm(ambientDim*2,ambientDim+1);
163//       int j=1;
164//       for (int i=0; i<ambientDim*2; i=i+2)
165//         {
166//           zm[i][0] = 1;
167//           zm[i][j] = 1;
168//           zm[i+1][0] = 1;
169//           zm[i+1][j] = -1;
170//           j = j+1;
171//         }
172//       gfan::ZCone* zc = new gfan::ZCone(zm, gfan::ZMatrix(0, zm.getWidth()));
173//       res->rtyp = coneID;
174//       res->data = (char *)zc;
175//       return FALSE;
176//     }
177//   WerrorS("cube: unexpected parameters");
178//   return TRUE;
179// }
180
181// BOOLEAN cross(leftv res, leftv args)
182// {
183//   leftv u = args;
184//   if ((u !=NULL) && (u->Typ() == INT_CMD))
185//     {
186//       int ambientDim = (int)(long)u->Data();
187//       if (ambientDim < 0)
188//      {
189//           Werror("expected non-negative ambient dim but got %d", ambientDim);
190//        return TRUE;
191//      }
192//       gfan::ZMatrix zm(ambientDim*2,ambientDim+1);
193//       int j=1;
194//       for (int i=0; i<ambientDim*2; i=i+2)
195//         {
196//           zm[i][0] = 1;
197//           zm[i][j] = 1;
198//           zm[i+1][0] = 1;
199//           zm[i+1][j] = -1;
200//           j = j+1;
201//         }
202//       gfan::ZCone* zc = new gfan::ZCone();
203//       *zc = gfan::ZCone::givenByRays(zm, gfan::ZMatrix(0, zm.getWidth()));
204//       res->rtyp = coneID;
205//       res->data = (char *)zc;
206//       return FALSE;
207//     }
208//   WerrorS("cross: unexpected parameters");
209//   return TRUE;
210// }
211
212
213BOOLEAN PMisLatticePolytope(leftv res, leftv args)
214{
215  leftv u = args;
216  if ((u != NULL) && (u->Typ() == polytopeID))
217  {
218    gfan::initializeCddlibIfRequired();
219    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
220    bool b;
221    try
222    {
223      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
224      b = p->give("Lattice");
225      delete p;
226    }
227    catch (const std::exception& ex)
228    {
229      gfan::deinitializeCddlibIfRequired();
230      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
231      return TRUE;
232    }
233    gfan::deinitializeCddlibIfRequired();
234    res->rtyp = INT_CMD;
235    res->data = (char*) (long) b;
236    return FALSE;
237  }
238  WerrorS("isLatticePolytope: unexpected parameters");
239  return TRUE;
240}
241
242
243BOOLEAN PMisBounded(leftv res, leftv args)
244{
245  leftv u = args;
246  if ((u != NULL) && (u->Typ() == polytopeID))
247  {
248    gfan::initializeCddlibIfRequired();
249    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
250    bool b;
251    try
252    {
253      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
254      b = p->give("BOUNDED");
255      delete p;
256    }
257    catch (const std::exception& ex)
258    {
259      gfan::deinitializeCddlibIfRequired();
260      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
261      return TRUE;
262    }
263    gfan::deinitializeCddlibIfRequired();
264    res->rtyp = INT_CMD;
265    res->data = (char*) (long) b;
266    return FALSE;
267  }
268  WerrorS("isBounded: unexpected parameters");
269  return TRUE;
270}
271
272
273BOOLEAN PMisReflexive(leftv res, leftv args)
274{
275  leftv u = args;
276  if ((u != NULL) && (u->Typ() == polytopeID))
277  {
278    gfan::initializeCddlibIfRequired();
279    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
280    bool b;
281    try
282    {
283      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
284      b = p->give("REFLEXIVE");
285      delete p;
286    }
287    catch (const std::exception& ex)
288    {
289      gfan::deinitializeCddlibIfRequired();
290      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
291      return TRUE;
292    }
293    gfan::deinitializeCddlibIfRequired();
294    res->rtyp = INT_CMD;
295    res->data = (char*) (long) b;
296    return FALSE;
297  }
298  WerrorS("isReflexive: unexpected parameters");
299  return TRUE;
300}
301
302
303BOOLEAN PMisGorenstein(leftv res, leftv args)
304{
305  leftv u = args;
306  if ((u != NULL) && (u->Typ() == polytopeID))
307  {
308    gfan::initializeCddlibIfRequired();
309    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
310    bool b;
311    try
312    {
313      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
314      b = p->give("GORENSTEIN");
315      delete p;
316    }
317    catch (const std::exception& ex)
318    {
319      gfan::deinitializeCddlibIfRequired();
320      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
321      return TRUE;
322    }
323    gfan::deinitializeCddlibIfRequired();
324    res->rtyp = INT_CMD;
325    res->data = (char*) (long) b;
326    return FALSE;
327  }
328  WerrorS("isGorenstein: unexpected parameters");
329  return TRUE;
330}
331
332
333BOOLEAN PMgorensteinIndex(leftv res, leftv args)
334{
335  leftv u = args;
336  if ((u != NULL) && (u->Typ() == polytopeID))
337  {
338    gfan::initializeCddlibIfRequired();
339    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
340    int gi;
341    bool ok = true;
342    try
343    {
344      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
345      bool b = p->give("GORENSTEIN");
346      if (b)
347      {
348        polymake::Integer pgi = p->give("GORENSTEIN_INDEX");
349        gi = PmInteger2Int(pgi,ok);
350        delete p;
351      }
352      else
353      {
354        delete p;
355        gfan::deinitializeCddlibIfRequired();
356        WerrorS("gorensteinIndex: input polytope not gorenstein");
357        return TRUE;
358      }
359    }
360    catch (const std::exception& ex)
361    {
362      gfan::deinitializeCddlibIfRequired();
363      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
364      return TRUE;
365    }
366    gfan::deinitializeCddlibIfRequired();
367    if (!ok)
368    {
369      WerrorS("overflow while converting polymake::Integer to int");
370      return TRUE;
371    }
372    res->rtyp = INT_CMD;
373    res->data = (char*) (long) gi;
374    return FALSE;
375  }
376  WerrorS("gorensteinIndex: unexpected parameters");
377  return TRUE;
378}
379
380
381BOOLEAN PMgorensteinVector(leftv res, leftv args)
382{
383  leftv u = args;
384  if ((u != NULL) && (u->Typ() == polytopeID))
385  {
386    gfan::initializeCddlibIfRequired();
387    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
388    intvec* gv;
389    bool ok = true;
390    try
391    {
392      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
393      bool b = p->give("GORENSTEIN");
394      if (b)
395      {
396        polymake::Vector<polymake::Integer> pgv = p->give("GORENSTEIN_VECTOR");
397        gv = PmVectorInteger2Intvec(&pgv,ok);
398        delete p;
399      }
400      else
401      {
402        delete p;
403        gfan::deinitializeCddlibIfRequired();
404        WerrorS("gorensteinVector: input polytope not gorenstein");
405        return TRUE;
406      }
407    }
408    catch (const std::exception& ex)
409    {
410      gfan::deinitializeCddlibIfRequired();
411      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
412      return TRUE;
413    }
414    gfan::deinitializeCddlibIfRequired();
415    if (!ok)
416    {
417      WerrorS("gorensteinVector: overflow in PmVectorInteger2Intvec");
418      return TRUE;
419    }
420    res->rtyp = INTVEC_CMD;
421    res->data = (char*) gv;
422    return FALSE;
423  }
424  WerrorS("gorensteinVector: unexpected parameters");
425  return TRUE;
426}
427
428
429BOOLEAN PMisCanonical(leftv res, leftv args)
430{
431  leftv u = args;
432  if ((u != NULL) && (u->Typ() == polytopeID))
433  {
434    gfan::initializeCddlibIfRequired();
435    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
436    bool b;
437    try
438    {
439      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
440      b = p->give("CANONICAL");
441      delete p;
442    }
443    catch (const std::exception& ex)
444    {
445      gfan::deinitializeCddlibIfRequired();
446      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
447      return TRUE;
448    }
449    gfan::deinitializeCddlibIfRequired();
450    res->rtyp = INT_CMD;
451    res->data = (char*) (long) b;
452    return FALSE;
453  }
454  WerrorS("isCanonical: unexpected parameters");
455  return TRUE;
456}
457
458
459BOOLEAN PMisTerminal(leftv res, leftv args)
460{
461  leftv u = args;
462  if ((u != NULL) && (u->Typ() == polytopeID))
463  {
464    gfan::initializeCddlibIfRequired();
465    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
466    bool b;
467    try
468    {
469      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
470      b = p->give("TERMINAL");
471      delete p;
472    }
473    catch (const std::exception& ex)
474    {
475      gfan::deinitializeCddlibIfRequired();
476      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
477      return TRUE;
478    }
479    gfan::deinitializeCddlibIfRequired();
480    res->rtyp = INT_CMD;
481    res->data = (char*) (long) b;
482    return FALSE;
483  }
484  WerrorS("isTerminal: unexpected parameters");
485  return TRUE;
486}
487
488
489BOOLEAN PMisLatticeEmpty(leftv res, leftv args)
490{
491  leftv u = args;
492  if ((u != NULL) && (u->Typ() == polytopeID))
493  {
494    gfan::initializeCddlibIfRequired();
495    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
496    bool b;
497    try
498    {
499      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
500      b = p->give("LATTICE_EMPTY");
501      delete p;
502    }
503    catch (const std::exception& ex)
504    {
505      gfan::deinitializeCddlibIfRequired();
506      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
507      return TRUE;
508    }
509    gfan::deinitializeCddlibIfRequired();
510    res->rtyp = INT_CMD;
511    res->data = (char*) (long) b;
512    return FALSE;
513  }
514  WerrorS("isLatticeEmpty: unexpected parameters");
515  return TRUE;
516}
517
518
519BOOLEAN PMlatticeVolume(leftv res, leftv args)
520{
521  leftv u = args;
522  if ((u != NULL) && (u->Typ() == polytopeID))
523  {
524    gfan::initializeCddlibIfRequired();
525    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
526    int lv;
527    bool ok = true;
528    try
529    {
530      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
531      polymake::Integer plv = p->give("LATTICE_VOLUME");
532      delete p;
533      lv = PmInteger2Int(plv,ok);
534    }
535    catch (const std::exception& ex)
536    {
537      gfan::deinitializeCddlibIfRequired();
538      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
539      return TRUE;
540    }
541    gfan::deinitializeCddlibIfRequired();
542    if (!ok)
543    {
544      WerrorS("overflow while converting polymake::Integer to int");
545      return TRUE;
546    }
547    res->rtyp = INT_CMD;
548    res->data = (char*) (long) lv;
549    return FALSE;
550  }
551  WerrorS("latticeVolume: unexpected parameters");
552  return TRUE;
553}
554
555
556BOOLEAN PMlatticeDegree(leftv res, leftv args)
557{
558  leftv u = args;
559  if ((u != NULL) && (u->Typ() == polytopeID))
560  {
561    gfan::initializeCddlibIfRequired();
562    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
563    int ld;
564    bool ok = true;
565    try
566    {
567      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
568      polymake::Integer pld = p->give("LATTICE_DEGREE");
569      delete p;
570      ld = PmInteger2Int(pld,ok);
571    }
572    catch (const std::exception& ex)
573    {
574      gfan::deinitializeCddlibIfRequired();
575      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
576      return TRUE;
577    }
578    gfan::deinitializeCddlibIfRequired();
579    if (!ok)
580    {
581      WerrorS("overflow while converting polymake::Integer to int");
582      return TRUE;
583    }
584    res->rtyp = INT_CMD;
585    res->data = (char*) (long) ld;
586    return FALSE;
587  }
588  WerrorS("latticeDegree: unexpected parameters");
589  return TRUE;
590}
591
592
593BOOLEAN PMlatticeCodegree(leftv res, leftv args)
594{
595  leftv u = args;
596  if ((u != NULL) && (u->Typ() == polytopeID))
597  {
598    gfan::initializeCddlibIfRequired();
599    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
600    int lc;
601    bool ok = true;
602    try
603    {
604      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
605      polymake::Integer plc = p->give("LATTICE_CODEGREE");
606      delete p;
607      lc = PmInteger2Int(plc,ok);
608    }
609    catch (const std::exception& ex)
610    {
611      gfan::deinitializeCddlibIfRequired();
612      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
613      return TRUE;
614    }
615    gfan::deinitializeCddlibIfRequired();
616    if (!ok)
617    {
618      WerrorS("overflow while converting polymake::Integer to int");
619      return TRUE;
620    }
621    res->rtyp = INT_CMD;
622    res->data = (char*) (long) lc;
623    return FALSE;
624  }
625  WerrorS("latticeCodegree: unexpected parameters");
626  return TRUE;
627}
628
629
630BOOLEAN PMehrhartPolynomialCoeff(leftv res, leftv args)
631{
632  leftv u = args;
633  if ((u != NULL) && (u->Typ() == polytopeID))
634  {
635    gfan::initializeCddlibIfRequired();
636    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
637    intvec* ec;
638    bool ok = true;
639    try
640    {
641      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
642      polymake::Vector<polymake::Integer> pec = p->give("EHRHART_POLYNOMIAL_COEFF");
643      delete p;
644      ec = PmVectorInteger2Intvec(&pec,ok);
645    }
646    catch (const std::exception& ex)
647    {
648      gfan::deinitializeCddlibIfRequired();
649      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
650      return TRUE;
651    }
652    gfan::deinitializeCddlibIfRequired();
653    if (!ok)
654    {
655      WerrorS("ehrhartPolynomialCoeff: overflow in PmVectorInteger2Intvec");
656      return TRUE;
657    }
658    res->rtyp = INTVEC_CMD;
659    res->data = (char*) ec;
660    return FALSE;
661  }
662  WerrorS("ehrhartPolynomialCoeff: unexpected parameters");
663  return TRUE;
664}
665
666
667BOOLEAN PMfVector(leftv res, leftv args)
668{
669  leftv u = args;
670  if ((u != NULL) && (u->Typ() == polytopeID))
671  {
672    gfan::initializeCddlibIfRequired();
673    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
674    intvec* hv;
675    bool ok = true;
676    try
677    {
678      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
679      polymake::Vector<polymake::Integer> phv = p->give("F_VECTOR");
680      delete p;
681      hv = PmVectorInteger2Intvec(&phv,ok);
682    }
683    catch (const std::exception& ex)
684    {
685      gfan::deinitializeCddlibIfRequired();
686      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
687      return TRUE;
688    }
689    gfan::deinitializeCddlibIfRequired();
690    if (!ok)
691    {
692      WerrorS("fVectorP: overflow in PmVectorInteger2Intvec");
693      return TRUE;
694    }
695    res->rtyp = INTVEC_CMD;
696    res->data = (char*) hv;
697    return FALSE;
698  }
699  WerrorS("fVectorP: unexpected parameters");
700  return TRUE;
701}
702
703
704BOOLEAN PMhVector(leftv res, leftv args)
705{
706  leftv u = args;
707  if ((u != NULL) && (u->Typ() == polytopeID))
708  {
709    gfan::initializeCddlibIfRequired();
710    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
711    intvec* hv;
712    bool ok = true;
713    try
714    {
715      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
716      polymake::Vector<polymake::Integer> phv = p->give("H_VECTOR");
717      delete p;
718      hv = PmVectorInteger2Intvec(&phv,ok);
719    }
720    catch (const std::exception& ex)
721    {
722      gfan::deinitializeCddlibIfRequired();
723      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
724      return TRUE;
725    }
726    gfan::deinitializeCddlibIfRequired();
727    if (!ok)
728    {
729      WerrorS("hVector: overflow in PmVectorInteger2Intvec");
730      return TRUE;
731    }
732    res->rtyp = INTVEC_CMD;
733    res->data = (char*) hv;
734    return FALSE;
735  }
736  WerrorS("hVector: unexpected parameters");
737  return TRUE;
738}
739
740
741BOOLEAN PMhStarVector(leftv res, leftv args)
742{
743  leftv u = args;
744  if ((u != NULL) && (u->Typ() == polytopeID))
745  {
746    gfan::initializeCddlibIfRequired();
747    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
748    intvec* hv;
749    bool ok = true;
750    try
751    {
752      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
753      polymake::Vector<polymake::Integer> phv = p->give("H_STAR_VECTOR");
754      delete p;
755      hv = PmVectorInteger2Intvec(&phv,ok);
756    }
757    catch (const std::exception& ex)
758    {
759      gfan::deinitializeCddlibIfRequired();
760      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
761      return TRUE;
762    }
763    gfan::deinitializeCddlibIfRequired();
764    if (!ok)
765    {
766      WerrorS("hStarVector: overflow in PmVectorInteger2Intvec");
767      return TRUE;
768    }
769    res->rtyp = INTVEC_CMD;
770    res->data = (char*) hv;
771    return FALSE;
772  }
773  WerrorS("hStarVector: unexpected parameters");
774  return TRUE;
775}
776
777
778BOOLEAN PMisNormal(leftv res, leftv args)
779{
780  leftv u = args;
781  if ((u != NULL) && (u->Typ() == polytopeID))
782  {
783    gfan::initializeCddlibIfRequired();
784    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
785    bool b;
786    try
787    {
788      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
789      b = p->give("NORMAL");
790      delete p;
791    }
792    catch (const std::exception& ex)
793    {
794      gfan::deinitializeCddlibIfRequired();
795      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
796      return TRUE;
797    }
798    gfan::deinitializeCddlibIfRequired();
799    res->rtyp = INT_CMD;
800    res->data = (char*) (long) b;
801    return FALSE;
802  }
803  WerrorS("isNormal: unexpected parameters");
804  return TRUE;
805}
806
807
808BOOLEAN PMfacetWidths(leftv res, leftv args)
809{
810  leftv u = args;
811  if ((u != NULL) && (u->Typ() == polytopeID))
812  {
813    gfan::initializeCddlibIfRequired();
814    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
815    intvec* fw;
816    bool ok = true;
817    try
818    {
819      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
820      polymake::Vector<polymake::Integer> pfw = p->give("FACET_WIDTHS");
821      delete p;
822      fw = PmVectorInteger2Intvec(&pfw,ok);
823    }
824    catch (const std::exception& ex)
825    {
826      gfan::deinitializeCddlibIfRequired();
827      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
828      return TRUE;
829    }
830    gfan::deinitializeCddlibIfRequired();
831    if (!ok)
832    {
833      WerrorS("facetWidths: overflow in PmVectorInteger2Intvec");
834      return TRUE;
835    }
836    res->rtyp = INTVEC_CMD;
837    res->data = (char*) fw;
838    return FALSE;
839  }
840  WerrorS("facetWidths: unexpected parameters");
841  return TRUE;
842}
843
844
845BOOLEAN PMfacetWidth(leftv res, leftv args)
846{
847  leftv u = args;
848  if ((u != NULL) && (u->Typ() == polytopeID))
849  {
850    gfan::initializeCddlibIfRequired();
851    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
852    int fw;
853    bool ok = true;
854    try
855    {
856      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
857      polymake::Integer pfw = p->give("FACET_WIDTH");
858      delete p;
859      fw = PmInteger2Int(pfw,ok);
860    }
861    catch (const std::exception& ex)
862    {
863      gfan::deinitializeCddlibIfRequired();
864      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
865      return TRUE;
866    }
867    gfan::deinitializeCddlibIfRequired();
868    if (!ok)
869    {
870      WerrorS("overflow while converting polymake::Integer to int");
871      return TRUE;
872    }
873    res->rtyp = INT_CMD;
874    res->data = (char*) (long) fw;
875    return FALSE;
876  }
877  WerrorS("facetWidth: unexpected parameters");
878  return TRUE;
879}
880
881
882BOOLEAN PMfacetVertexLatticeDistances(leftv res, leftv args)
883{
884  leftv u = args;
885  if ((u != NULL) && (u->Typ() == polytopeID))
886  {
887    gfan::initializeCddlibIfRequired();
888    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
889    intvec* ld;
890    bool ok=true;
891    try
892    {
893      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
894      polymake::Matrix<polymake::Integer> pld = p->give("FACET_VERTEX_LATTICE_DISTANCES");
895      delete p;
896      ld = PmMatrixInteger2Intvec(&pld,ok);
897    }
898    catch (const std::exception& ex)
899    {
900      gfan::deinitializeCddlibIfRequired();
901      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
902      return TRUE;
903    }
904    gfan::deinitializeCddlibIfRequired();
905    if (!ok)
906    {
907      WerrorS("overflow while converting polymake::Integer to int");
908      return TRUE;
909    }
910    res->rtyp = INTMAT_CMD;
911    res->data = (char*) ld;
912    return FALSE;
913  }
914  WerrorS("facetVertexLatticeDistances: unexpected parameters");
915  return TRUE;
916}
917
918
919BOOLEAN PMisCompressed(leftv res, leftv args)
920{
921  leftv u = args;
922  if ((u != NULL) && (u->Typ() == polytopeID))
923  {
924    gfan::initializeCddlibIfRequired();
925    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
926    bool b;
927    try
928    {
929      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
930      b = p->give("COMPRESSED");
931      delete p;
932    }
933    catch (const std::exception& ex)
934    {
935      gfan::deinitializeCddlibIfRequired();
936      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
937      return TRUE;
938    }
939    gfan::deinitializeCddlibIfRequired();
940    res->rtyp = INT_CMD;
941    res->data = (char*) (long) b;
942    return FALSE;
943  }
944  WerrorS("isCompressed: unexpected parameters");
945  return TRUE;
946}
947
948
949BOOLEAN PMisSmooth(leftv res, leftv args)
950{
951  leftv u = args;
952  if ((u != NULL) && (u->Typ() == coneID))
953  {
954    gfan::initializeCddlibIfRequired();
955    gfan::ZCone* zc = (gfan::ZCone*)u->Data();
956    bool b;
957    try
958    {
959      polymake::perl::Object* p = ZCone2PmCone(zc);
960      b = p->give("SMOOTH_CONE");
961      delete p;
962    }
963    catch (const std::exception& ex)
964    {
965      gfan::deinitializeCddlibIfRequired();
966      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
967      return TRUE;
968    }
969    gfan::deinitializeCddlibIfRequired();
970    res->rtyp = INT_CMD;
971    res->data = (char*) (long) b;
972    return FALSE;
973  }
974  if ((u != NULL) && (u->Typ() == polytopeID))
975  {
976    gfan::initializeCddlibIfRequired();
977    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
978    bool b;
979    try
980    {
981      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
982      b = p->give("SMOOTH");
983      delete p;
984    }
985    catch (const std::exception& ex)
986    {
987      gfan::deinitializeCddlibIfRequired();
988      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
989      return TRUE;
990    }
991    gfan::deinitializeCddlibIfRequired();
992    res->rtyp = INT_CMD;
993    res->data = (char*) (long) b;
994    return FALSE;
995  }
996  if ((u != NULL) && (u->Typ() == fanID))
997  {
998    gfan::initializeCddlibIfRequired();
999    gfan::ZFan* zf = (gfan::ZFan*)u->Data();
1000    bool b;
1001    try
1002    {
1003      polymake::perl::Object* p = ZFan2PmFan(zf);
1004      b = p->give("SMOOTH_FAN");
1005      delete p;
1006    }
1007    catch (const std::exception& ex)
1008    {
1009      gfan::deinitializeCddlibIfRequired();
1010      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1011      return TRUE;
1012    }
1013    gfan::deinitializeCddlibIfRequired();
1014    res->rtyp = INT_CMD;
1015    res->data = (char*) (long) b;
1016    return FALSE;
1017  }
1018  WerrorS("isSmooth: unexpected parameters");
1019  return TRUE;
1020}
1021
1022
1023BOOLEAN PMisVeryAmple(leftv res, leftv args)
1024{
1025  leftv u = args;
1026  if ((u != NULL) && (u->Typ() == polytopeID))
1027  {
1028    gfan::initializeCddlibIfRequired();
1029    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1030    bool b;
1031    try
1032    {
1033      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1034      b = p->give("VERY_AMPLE");
1035      delete p;
1036    }
1037    catch (const std::exception& ex)
1038    {
1039      gfan::deinitializeCddlibIfRequired();
1040      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1041      return TRUE;
1042    }
1043    gfan::deinitializeCddlibIfRequired();
1044    res->rtyp = INT_CMD;
1045    res->data = (char*) (long) b;
1046    return FALSE;
1047  }
1048  WerrorS("isVeryAmple: unexpected parameters");
1049  return TRUE;
1050}
1051
1052
1053BOOLEAN PMlatticePoints(leftv res, leftv args)
1054{
1055  leftv u = args;
1056  if ((u != NULL) && (u->Typ() == polytopeID))
1057  {
1058    gfan::initializeCddlibIfRequired();
1059    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1060    intvec* iv;
1061    bool ok = true;
1062    try
1063    {
1064      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1065      #if (POLYMAKEVERSION >=214)
1066      polymake::Matrix<polymake::Integer> lp = p->CallPolymakeMethod("LATTICE_POINTS");
1067      #elif (POLYMAKEVERSION >=212)
1068      polymake::Matrix<polymake::Integer> lp = p->give("LATTICE_POINTS");
1069      #else
1070        #error polymake version too old
1071      #endif
1072      delete p;
1073      iv = PmMatrixInteger2Intvec(&lp,ok);
1074    }
1075    catch (const std::exception& ex)
1076    {
1077      gfan::deinitializeCddlibIfRequired();
1078      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1079      return TRUE;
1080    }
1081    gfan::deinitializeCddlibIfRequired();
1082    if (!ok)
1083    {
1084      WerrorS("overflow while converting polymake::Integer to int");
1085      return TRUE;
1086    }
1087    res->rtyp = INTMAT_CMD;
1088    res->data = (char*) iv;
1089    return FALSE;
1090  }
1091  WerrorS("LatticePoints: unexpected parameters");
1092  return TRUE;
1093}
1094
1095
1096BOOLEAN PMnLatticePoints(leftv res, leftv args)
1097{
1098  leftv u = args;
1099  if ((u != NULL) && (u->Typ() == polytopeID))
1100  {
1101    gfan::initializeCddlibIfRequired();
1102    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1103    int n;
1104    bool ok = true;
1105    try
1106    {
1107      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1108      polymake::Integer nlp = p->give("N_LATTICE_POINTS");
1109      delete p;
1110      n = PmInteger2Int(nlp,ok);
1111    }
1112    catch (const std::exception& ex)
1113    {
1114      gfan::deinitializeCddlibIfRequired();
1115      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1116      return TRUE;
1117    }
1118    gfan::deinitializeCddlibIfRequired();
1119    if (!ok)
1120    {
1121      WerrorS("overflow while converting polymake::Integer to int");
1122      return TRUE;
1123    }
1124    res->rtyp = INT_CMD;
1125    res->data = (char*) (long) n;
1126    return FALSE;
1127  }
1128  WerrorS("nLatticePoints: unexpected parameters");
1129  return TRUE;
1130}
1131
1132
1133BOOLEAN PMinteriorLatticePoints(leftv res, leftv args)
1134{
1135  leftv u = args;
1136  if ((u != NULL) && (u->Typ() == polytopeID))
1137  {
1138    gfan::initializeCddlibIfRequired();
1139    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1140    intvec* iv;
1141    bool ok = true;
1142    try
1143    {
1144      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1145      polymake::Matrix<polymake::Integer> lp = p->give("INTERIOR_LATTICE_POINTS");
1146      delete p;
1147      iv = PmMatrixInteger2Intvec(&lp,ok);
1148    }
1149    catch (const std::exception& ex)
1150    {
1151      gfan::deinitializeCddlibIfRequired();
1152      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1153      return TRUE;
1154    }
1155    gfan::deinitializeCddlibIfRequired();
1156    if (!ok)
1157    {
1158      WerrorS("overflow while converting polymake::Integer to int");
1159      return TRUE;
1160    }
1161    res->rtyp = INTMAT_CMD;
1162    res->data = (char*) iv;
1163    return FALSE;
1164  }
1165  WerrorS("interiorLatticePoints: unexpected parameters");
1166  return TRUE;
1167}
1168
1169
1170BOOLEAN PMnInteriorLatticePoints(leftv res, leftv args)
1171{
1172  leftv u = args;
1173  if ((u != NULL) && (u->Typ() == polytopeID))
1174  {
1175    gfan::initializeCddlibIfRequired();
1176    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1177    int n;
1178    bool ok = true;
1179    try
1180    {
1181      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1182      polymake::Integer nlp = p->give("N_INTERIOR_LATTICE_POINTS");
1183      delete p;
1184      n = PmInteger2Int(nlp,ok);
1185    }
1186    catch (const std::exception& ex)
1187    {
1188      gfan::deinitializeCddlibIfRequired();
1189      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1190      return TRUE;
1191    }
1192    gfan::deinitializeCddlibIfRequired();
1193    if (!ok)
1194    {
1195      WerrorS("overflow while converting polymake::Integer to int");
1196      return TRUE;
1197    }
1198    res->rtyp = INT_CMD;
1199    res->data = (char*) (long) n;
1200    return FALSE;
1201  }
1202  WerrorS("nInteriorLatticePoints: unexpected parameters");
1203  return TRUE;
1204}
1205
1206
1207BOOLEAN PMboundaryLatticePoints(leftv res, leftv args)
1208{
1209  leftv u = args;
1210  if ((u != NULL) && (u->Typ() == polytopeID))
1211  {
1212    gfan::initializeCddlibIfRequired();
1213    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1214    intvec* iv;
1215    bool ok = true;
1216    try
1217    {
1218      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1219      polymake::Matrix<polymake::Integer> lp = p->give("BOUNDARY_LATTICE_POINTS");
1220      delete p;
1221      iv = PmMatrixInteger2Intvec(&lp,ok);
1222    }
1223    catch (const std::exception& ex)
1224    {
1225      gfan::deinitializeCddlibIfRequired();
1226      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1227      return TRUE;
1228    }
1229    gfan::deinitializeCddlibIfRequired();
1230    if (!ok)
1231    {
1232      WerrorS("overflow while converting polymake::Integer to int");
1233      return TRUE;
1234    }
1235    res->rtyp = INTMAT_CMD;
1236    res->data = (char*) iv;
1237    return FALSE;
1238  }
1239  WerrorS("boundaryLatticePoints: unexpected parameters");
1240  return TRUE;
1241}
1242
1243
1244BOOLEAN PMnBoundaryLatticePoints(leftv res, leftv args)
1245{
1246  leftv u = args;
1247  if ((u != NULL) && (u->Typ() == polytopeID))
1248  {
1249    gfan::initializeCddlibIfRequired();
1250    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1251    int n;
1252    bool ok = true;
1253    try
1254    {
1255      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1256      polymake::Integer nlp = p->give("N_BOUNDARY_LATTICE_POINTS");
1257      delete p;
1258      n = PmInteger2Int(nlp,ok);
1259    }
1260    catch (const std::exception& ex)
1261    {
1262      gfan::deinitializeCddlibIfRequired();
1263      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1264      return TRUE;
1265    }
1266    gfan::deinitializeCddlibIfRequired();
1267    if (!ok)
1268    {
1269      WerrorS("overflow while converting polymake::Integer to int");
1270      return TRUE;
1271    }
1272    res->rtyp = INT_CMD;
1273    res->data = (char*) (long) n;
1274    return FALSE;
1275  }
1276  WerrorS("nBoundaryLatticePoints: unexpected parameters");
1277  return TRUE;
1278}
1279
1280
1281BOOLEAN PMhilbertBasis(leftv res, leftv args)
1282{
1283  leftv u = args;
1284  if ((u != NULL) && (u->Typ() == coneID))
1285  {
1286    gfan::initializeCddlibIfRequired();
1287    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1288    intvec* iv;
1289    bool ok = true;
1290    try
1291    {
1292      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1293      #if (POLYMAKEVERSION >=214)
1294      polymake::Matrix<polymake::Integer> lp = p->CallPolymakeMethod("HILBERT_BASIS");
1295      #elif (POLYMAKEVERSION >=212)
1296      polymake::Matrix<polymake::Integer> lp = p->give("HILBERT_BASIS");
1297      #else
1298        #error polymake version too old
1299      #endif
1300      delete p;
1301      iv = PmMatrixInteger2Intvec(&lp,ok);
1302    }
1303    catch (const std::exception& ex)
1304    {
1305      gfan::deinitializeCddlibIfRequired();
1306      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1307      return TRUE;
1308    }
1309    gfan::deinitializeCddlibIfRequired();
1310    if (!ok)
1311    {
1312      WerrorS("overflow while converting polymake::Integer to int");
1313      return TRUE;
1314    }
1315    res->rtyp = INTMAT_CMD;
1316    res->data = (char*) iv;
1317    return FALSE;
1318  }
1319  WerrorS("hilbertBasis: unexpected parameters");
1320  return TRUE;
1321}
1322
1323
1324BOOLEAN PMnHilbertBasis(leftv res, leftv args)
1325{
1326  leftv u = args;
1327  if ((u != NULL) && (u->Typ() == coneID))
1328  {
1329    gfan::initializeCddlibIfRequired();
1330    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1331    int n;
1332    bool ok = true;
1333    try
1334    {
1335      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1336      polymake::Integer nlp = p->give("N_HILBERT_BASIS");
1337      delete p;
1338      n = PmInteger2Int(nlp,ok);
1339    }
1340    catch (const std::exception& ex)
1341    {
1342      gfan::deinitializeCddlibIfRequired();
1343      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1344      return TRUE;
1345    }
1346    gfan::deinitializeCddlibIfRequired();
1347    if (!ok)
1348    {
1349      WerrorS("overflow while converting polymake::Integer to int");
1350      return TRUE;
1351    }
1352    res->rtyp = INT_CMD;
1353    res->data = (char*) (long) n;
1354    return FALSE;
1355  }
1356  WerrorS("nHilbertBasis: unexpected parameters");
1357  return TRUE;
1358}
1359
1360
1361BOOLEAN PMminkowskiSum(leftv res, leftv args)
1362{
1363  leftv u = args;
1364  if ((u != NULL) && (u->Typ() == polytopeID))
1365  {
1366    leftv v = u->next;
1367    if ((v != NULL) && (v->Typ() == polytopeID))
1368    {
1369      gfan::initializeCddlibIfRequired();
1370      gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1371      gfan::ZCone* zq = (gfan::ZCone*)v->Data();
1372      gfan::ZCone* ms;
1373      try
1374      {
1375        polymake::perl::Object* pp = ZPolytope2PmPolytope(zp);
1376        polymake::perl::Object* pq = ZPolytope2PmPolytope(zq);
1377        polymake::perl::Object pms;
1378        CallPolymakeFunction("minkowski_sum", *pp, *pq) >> pms;
1379        delete pp;
1380        delete pq;
1381        ms = PmPolytope2ZPolytope(&pms);
1382      }
1383      catch (const std::exception& ex)
1384      {
1385        gfan::deinitializeCddlibIfRequired();
1386        WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1387        return TRUE;
1388      }
1389      gfan::deinitializeCddlibIfRequired();
1390      res->rtyp = polytopeID;
1391      res->data = (char*) ms;
1392      return FALSE;
1393    }
1394    if ((v != NULL) && (v->Typ() == coneID))
1395    {
1396      gfan::initializeCddlibIfRequired();
1397      gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1398      gfan::ZCone* zc = (gfan::ZCone*)v->Data();
1399      gfan::ZCone* zq = new gfan::ZCone(liftUp(*zc));
1400      gfan::ZCone* ms;
1401      try
1402      {
1403        polymake::perl::Object* pp = ZPolytope2PmPolytope(zp);
1404        polymake::perl::Object* pq = ZPolytope2PmPolytope(zq);
1405        polymake::perl::Object pms;
1406        CallPolymakeFunction("minkowski_sum", *pp, *pq) >> pms;
1407        delete pp;
1408        delete pq;
1409        ms = PmPolytope2ZPolytope(&pms);
1410      }
1411      catch (const std::exception& ex)
1412      {
1413        delete zq;
1414        gfan::deinitializeCddlibIfRequired();
1415        WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1416        return TRUE;
1417      }
1418      delete zq;
1419      gfan::deinitializeCddlibIfRequired();
1420      res->rtyp = polytopeID;
1421      res->data = (char*) ms;
1422      return FALSE;
1423    }
1424  }
1425  if ((u != NULL) && (u->Typ() == coneID))
1426  {
1427    leftv v = u->next;
1428    if ((v != NULL) && (v->Typ() == polytopeID))
1429    {
1430      gfan::initializeCddlibIfRequired();
1431      gfan::ZCone* zc = (gfan::ZCone*)u->Data();
1432      gfan::ZCone* zp = new gfan::ZCone(liftUp(*zc));
1433      gfan::ZCone* zq = (gfan::ZCone*)v->Data();
1434      gfan::ZCone* ms;
1435      try
1436      {
1437        polymake::perl::Object* pp = ZPolytope2PmPolytope(zp);
1438        polymake::perl::Object* pq = ZPolytope2PmPolytope(zq);
1439        polymake::perl::Object pms;
1440        CallPolymakeFunction("minkowski_sum", *pp, *pq) >> pms;
1441        delete pp;
1442        delete pq;
1443        ms = PmPolytope2ZPolytope(&pms);
1444      }
1445      catch (const std::exception& ex)
1446      {
1447        delete zp;
1448        gfan::deinitializeCddlibIfRequired();
1449        WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1450        return TRUE;
1451      }
1452      delete zp;
1453      gfan::deinitializeCddlibIfRequired();
1454      res->rtyp = polytopeID;
1455      res->data = (char*) ms;
1456      return FALSE;
1457    }
1458    if ((v != NULL) && (v->Typ() == coneID))
1459    {
1460      gfan::initializeCddlibIfRequired();
1461      gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1462      gfan::ZCone* zq = (gfan::ZCone*)v->Data();
1463      gfan::ZCone* ms;
1464      try
1465      {
1466        polymake::perl::Object* pp = ZPolytope2PmPolytope(zp);
1467        polymake::perl::Object* pq = ZPolytope2PmPolytope(zq);
1468        polymake::perl::Object pms;
1469        CallPolymakeFunction("minkowski_sum", *pp, *pq) >> pms;
1470        delete pp;
1471        delete pq;
1472        ms = PmPolytope2ZPolytope(&pms);
1473      }
1474      catch (const std::exception& ex)
1475      {
1476        WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1477        gfan::deinitializeCddlibIfRequired();
1478        return TRUE;
1479      }
1480      gfan::deinitializeCddlibIfRequired();
1481      res->rtyp = coneID;
1482      res->data = (char*) ms;
1483      return FALSE;
1484    }
1485  }
1486  WerrorS("minkowskiSum: unexpected parameters");
1487  return TRUE;
1488}
1489
1490
1491polymake::Matrix<polymake::Integer> verticesOf(const polymake::perl::Object* p,
1492                                               const polymake::Set<polymake::Integer>* s)
1493{
1494  polymake::Matrix<polymake::Integer> allrays = p->give("VERTICES");
1495  polymake::Matrix<polymake::Integer> wantedrays;
1496  bool ok = true;
1497  for(polymake::Entire<polymake::Set<polymake::Integer> >::const_iterator i=polymake::entire(*s); !i.at_end(); i++)
1498  {
1499    wantedrays = wantedrays / allrays.row(PmInteger2Int(*i,ok));
1500  }
1501  if (!ok)
1502  {
1503    WerrorS("overflow while converting polymake::Integer to int in raysOf");
1504  }
1505  return wantedrays;
1506}
1507
1508
1509BOOLEAN PMmaximalFace(leftv res, leftv args)
1510{
1511  leftv u = args;
1512  if ((u != NULL) && (u->Typ() == polytopeID))
1513  {
1514    leftv v = u->next;
1515    if ((v != NULL) && (v->Typ() == INTVEC_CMD))
1516    {
1517      gfan::initializeCddlibIfRequired();
1518      gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1519      intvec* iv = (intvec*) v->Data();
1520      intvec* maxface;
1521      bool ok = true;
1522      try
1523      {
1524        polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1525        polymake::perl::Object o("LinearProgram<Rational>");
1526        o.take("LINEAR_OBJECTIVE") << Intvec2PmVectorInteger(iv);
1527        p->take("LP") << o;
1528        polymake::Set<polymake::Integer> mf = p->give("LP.MAXIMAL_FACE");
1529        polymake::Matrix<polymake::Integer> vertices = verticesOf(p,&mf);
1530        delete p;
1531        maxface = new intvec(PmMatrixInteger2Intvec(&vertices,ok));
1532      }
1533      catch (const std::exception& ex)
1534      {
1535        WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1536        gfan::deinitializeCddlibIfRequired();
1537        return TRUE;
1538      }
1539      gfan::deinitializeCddlibIfRequired();
1540      if (!ok)
1541      {
1542        WerrorS("overflow while converting polymake::Integer to int");
1543        return TRUE;
1544      }
1545      res->rtyp = INTVEC_CMD;
1546      res->data = (char*) maxface;
1547      return FALSE;
1548    }
1549  }
1550  WerrorS("maximalFace: unexpected parameters");
1551  return TRUE;
1552}
1553
1554
1555BOOLEAN PMminimalFace(leftv res, leftv args)
1556{
1557  leftv u = args;
1558  if ((u != NULL) && (u->Typ() == polytopeID))
1559  {
1560    leftv v = u->next;
1561    if ((v != NULL) && (v->Typ() == INTVEC_CMD))
1562    {
1563      gfan::initializeCddlibIfRequired();
1564      gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1565      intvec* iv = (intvec*) v->Data();
1566      intvec* minface;
1567      bool ok = true;
1568      try
1569      {
1570        polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1571        polymake::perl::Object o("LinearProgram<Rational>");
1572        o.take("LINEAR_OBJECTIVE") << Intvec2PmVectorInteger(iv);
1573        p->take("LP") << o;
1574        polymake::Set<polymake::Integer> mf = p->give("LP.MINIMAL_FACE");
1575        polymake::Matrix<polymake::Integer> vertices = verticesOf(p,&mf);
1576        delete p;
1577        minface = new intvec(PmMatrixInteger2Intvec(&vertices,ok));
1578      }
1579      catch (const std::exception& ex)
1580      {
1581        WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1582        gfan::deinitializeCddlibIfRequired();
1583        return TRUE;
1584      }
1585      gfan::deinitializeCddlibIfRequired();
1586      if (!ok)
1587      {
1588        WerrorS("overflow while converting polymake::Integer to int");
1589        return TRUE;
1590      }
1591      res->rtyp = INTVEC_CMD;
1592      res->data = (char*) minface;
1593      return FALSE;
1594    }
1595  }
1596  WerrorS("minimalFace: unexpected parameters");
1597  return TRUE;
1598}
1599
1600
1601BOOLEAN PMmaximalValue(leftv res, leftv args)
1602{
1603  leftv u = args;
1604  if ((u != NULL) && (u->Typ() == polytopeID))
1605  {
1606    leftv v = u->next;
1607    if ((v != NULL) && (v->Typ() == INTVEC_CMD))
1608    {
1609      gfan::initializeCddlibIfRequired();
1610      gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1611      intvec* iv = (intvec*) v->Data();
1612      if (iv->rows()==zp->ambientDimension())
1613      {
1614        int m;
1615        bool ok = true;
1616        try
1617        {
1618          polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1619          polymake::Vector<polymake::Integer> lo = Intvec2PmVectorInteger(iv);
1620          polymake::perl::Object o("LinearProgram<Rational>");
1621          o.take("LINEAR_OBJECTIVE") << lo;
1622          p->take("LP") << o;
1623          polymake::Integer mv = p->give("LP.MAXIMAL_VALUE");
1624          delete p;
1625          m = PmInteger2Int(mv,ok);
1626        }
1627        catch (const std::exception& ex)
1628        {
1629          WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1630          gfan::deinitializeCddlibIfRequired();
1631          return TRUE;
1632        }
1633        gfan::deinitializeCddlibIfRequired();
1634        if (!ok)
1635        {
1636          WerrorS("overflow while converting polymake::Integer to int");
1637          return TRUE;
1638        }
1639        res->rtyp = INT_CMD;
1640        res->data = (char*) (long) m;
1641        return FALSE;
1642      }
1643    }
1644    WerrorS("maximalValue: vector is of wrong size");
1645    return TRUE;
1646  }
1647  WerrorS("maximalValue: unexpected parameters");
1648  return TRUE;
1649}
1650
1651BOOLEAN PMminimalValue(leftv res, leftv args)
1652{
1653  leftv u = args;
1654  if ((u != NULL) && (u->Typ() == polytopeID))
1655  {
1656    leftv v = u->next;
1657    if ((v != NULL) && (v->Typ() == INTVEC_CMD))
1658    {
1659      gfan::initializeCddlibIfRequired();
1660      gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1661      intvec* iv = (intvec*) v->Data();
1662      if (iv->rows()==zp->ambientDimension())
1663      {
1664        int m;
1665        bool ok = true;
1666        try
1667        {
1668          polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1669          polymake::Vector<polymake::Integer> lo = Intvec2PmVectorInteger(iv);
1670          polymake::perl::Object o("LinearProgram<Rational>");
1671          o.take("LINEAR_OBJECTIVE") << lo;
1672          p->take("LP") << o;
1673          polymake::Integer mv = p->give("LP.MINIMAL_VALUE");
1674          delete p;
1675          m = PmInteger2Int(mv,ok);
1676        }
1677        catch (const std::exception& ex)
1678        {
1679          WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1680          gfan::deinitializeCddlibIfRequired();
1681          return TRUE;
1682        }
1683        gfan::deinitializeCddlibIfRequired();
1684        if (!ok)
1685        {
1686          WerrorS("overflow while converting polymake::Integer to int");
1687          return TRUE;
1688        }
1689        res->rtyp = INT_CMD;
1690        res->data = (char*) (long) m;
1691        return FALSE;
1692      }
1693    }
1694    WerrorS("minimalValue: vector is of wrong size");
1695    return TRUE;
1696  }
1697  WerrorS("minimalValue: unexpected parameters");
1698  return TRUE;
1699}
1700
1701
1702BOOLEAN visual(leftv res, leftv args)
1703{
1704  leftv u = args;
1705  if ((u != NULL) && (u->Typ() == polytopeID))
1706  {
1707    gfan::initializeCddlibIfRequired();
1708    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1709    try
1710    {
1711      polymake::perl::Object* pp = ZPolytope2PmPolytope(zp);
1712      VoidCallPolymakeFunction("jreality",pp->CallPolymakeMethod("VISUAL"));
1713      delete pp;
1714    }
1715    catch (const std::exception& ex)
1716    {
1717      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1718      gfan::deinitializeCddlibIfRequired();
1719      return TRUE;
1720    }
1721    gfan::deinitializeCddlibIfRequired();
1722    res->rtyp = NONE;
1723    res->data = NULL;
1724    return FALSE;
1725  }
1726  if ((u != NULL) && (u->Typ() == fanID))
1727  {
1728    gfan::initializeCddlibIfRequired();
1729    gfan::ZFan* zf = (gfan::ZFan*)u->Data();
1730    try
1731    {
1732      polymake::perl::Object* pf=ZFan2PmFan(zf);
1733      VoidCallPolymakeFunction("jreality",pf->CallPolymakeMethod("VISUAL"));
1734    }
1735    catch (const std::exception& ex)
1736    {
1737      gfan::deinitializeCddlibIfRequired();
1738      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1739      return TRUE;
1740    }
1741    gfan::deinitializeCddlibIfRequired();
1742    res->rtyp = NONE;
1743    res->data = NULL;
1744    return FALSE;
1745  }
1746  WerrorS("visual: unexpected parameters");
1747  return TRUE;
1748}
1749
1750BOOLEAN normalFan(leftv res, leftv args)
1751{
1752  leftv u = args;
1753  if ((u != NULL) && (u->Typ() == polytopeID))
1754  {
1755    gfan::initializeCddlibIfRequired();
1756    gfan::ZCone* zp = (gfan::ZCone*)u->Data();
1757    gfan::ZFan* zf = new gfan::ZFan(0);
1758    try
1759    {
1760      polymake::perl::Object* p=ZPolytope2PmPolytope(zp);
1761      polymake::perl::Object pf;
1762      CallPolymakeFunction("normal_fan", *p) >> pf;
1763      delete p;
1764      zf = PmFan2ZFan(&pf);
1765    }
1766    catch (const std::exception& ex)
1767    {
1768      gfan::deinitializeCddlibIfRequired();
1769      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1770      return TRUE;
1771    }
1772    gfan::deinitializeCddlibIfRequired();
1773    res->rtyp = fanID;
1774    res->data = (char*) zf;
1775    return FALSE;
1776  }
1777  WerrorS("normalFan: unexpected parameters");
1778  return TRUE;
1779}
1780
1781BOOLEAN PMconeViaRays(leftv res, leftv args)
1782{
1783  leftv u = args;
1784  if ((u != NULL) && (u->Typ() == INTMAT_CMD))
1785  {
1786    gfan::initializeCddlibIfRequired();
1787    polymake::perl::Object pc("Cone<Rational>");
1788    intvec* hlines = (intvec*) u->Data(); // these will are half lines in the cone
1789    polymake::Matrix<polymake::Integer> pmhlines = Intvec2PmMatrixInteger(hlines);
1790    pc.take("INPUT_RAYS") << pmhlines;
1791
1792    leftv v = u->next;
1793    if ((v != NULL) && (v->Typ() == INTMAT_CMD))
1794    {
1795      intvec* lines = (intvec*) v->Data(); // these will be lines in the cone
1796      polymake::Matrix<polymake::Integer> pmlines = Intvec2PmMatrixInteger(lines);
1797      pc.take("INPUT_LINEALITY") << pmlines;
1798
1799      // leftv w = v->next;
1800      // if ((w != NULL) && (w->Typ() == INT_CMD))
1801      // {
1802      //   int flag = (int) (long) w->Data(); // TODO: this will indicate whether the
1803      //                                      // information provided are exact
1804      // }
1805    }
1806    gfan::ZCone* zc = PmCone2ZCone(&pc);
1807    gfan::deinitializeCddlibIfRequired();
1808    res->rtyp = coneID;
1809    res->data = (char*) zc;
1810    return FALSE;
1811  }
1812  WerrorS("coneViaRays: unexpected parameters");
1813  return TRUE;
1814}
1815
1816
1817BOOLEAN PMpolytopeViaVertices(leftv res, leftv args)
1818{
1819  leftv u = args;
1820  if ((u != NULL) && (u->Typ() == INTMAT_CMD))
1821  {
1822    gfan::initializeCddlibIfRequired();
1823    polymake::perl::Object pp("Polytope<Rational>");
1824    intvec* points = (intvec*) u->Data(); // these will be vertices of or points in the polytope
1825    polymake::Matrix<polymake::Integer> pmpoints = Intvec2PmMatrixInteger(points);
1826
1827    leftv v = u->next;
1828    if ((v != NULL) && (v->Typ() == INT_CMD))
1829    {
1830      int flag = (int) (long) v->Data();
1831      switch(flag)
1832      {
1833        case 0:  pp.take("POINTS") << pmpoints;   // case means the matrix may contain points inside the polytope
1834        case 1:  pp.take("VERTICES") << pmpoints; // case means the matrix only contains vertices of the polytope
1835        default: WerrorS("polytopeViaVertices: invalid flag");
1836      }
1837    }
1838    else
1839      pp.take("POINTS") << pmpoints;              // by default, we assume that matrix may contain non-vertices
1840
1841    gfan::ZCone* zp = PmPolytope2ZPolytope(&pp);
1842    gfan::deinitializeCddlibIfRequired();
1843    res->rtyp = polytopeID;
1844    res->data = (char*) zp;
1845    return FALSE;
1846  }
1847  WerrorS("polytopeViaVertices: unexpected parameters");
1848  return TRUE;
1849}
1850
1851
1852BOOLEAN PMvertexAdjacencyGraph(leftv res, leftv args)
1853{
1854  leftv u = args;
1855  if ((u != NULL) && (u->Typ() == polytopeID))
1856  {
1857    gfan::initializeCddlibIfRequired();
1858    gfan::ZCone* zp = (gfan::ZCone*) u->Data();
1859    lists output=(lists)omAllocBin(slists_bin); output->Init(2);
1860    try
1861    {
1862      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1863      polymake::Matrix<polymake::Integer> vert0 = p->give("VERTICES");
1864      bigintmat* vert1 = PmMatrixInteger2Bigintmat(&vert0);
1865      output->m[0].rtyp = BIGINTMAT_CMD;
1866      output->m[0].data = (void*) vert1;
1867
1868      polymake::Graph<> gr=p->give("GRAPH.ADJACENCY");
1869      polymake::IncidenceMatrix<polymake::NonSymmetric> adj = adjacency_matrix(gr);
1870      lists listOfEdges = PmIncidenceMatrix2ListOfIntvecs(&adj);
1871      output->m[1].rtyp = LIST_CMD;
1872      output->m[1].data = (void*) listOfEdges;
1873      delete p;
1874    }
1875    catch (const std::exception& ex)
1876    {
1877      gfan::deinitializeCddlibIfRequired();
1878      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1879      return TRUE;
1880    }
1881    gfan::deinitializeCddlibIfRequired();
1882    res->rtyp = LIST_CMD;
1883    res->data = (void*) output;
1884    return FALSE;
1885  }
1886  WerrorS("vertexEdgeGraph: unexpected parameters");
1887  return TRUE;
1888}
1889
1890
1891BOOLEAN PMvertexEdgeGraph(leftv res, leftv args)
1892{
1893  leftv u = args;
1894  if ((u != NULL) && (u->Typ() == polytopeID))
1895  {
1896    gfan::initializeCddlibIfRequired();
1897    gfan::ZCone* zp = (gfan::ZCone*) u->Data();
1898    lists output=(lists)omAllocBin(slists_bin); output->Init(2);
1899    try
1900    {
1901      polymake::perl::Object* p = ZPolytope2PmPolytope(zp);
1902      polymake::Matrix<polymake::Integer> vert0 = p->give("VERTICES");
1903      bigintmat* vert1 = PmMatrixInteger2Bigintmat(&vert0);
1904      output->m[0].rtyp = BIGINTMAT_CMD;
1905      output->m[0].data = (void*) vert1;
1906
1907      polymake::Graph<> gr=p->give("GRAPH.ADJACENCY");
1908      polymake::IncidenceMatrix<polymake::NonSymmetric> adj = adjacency_matrix(gr);
1909      lists listOfEdges = PmAdjacencyMatrix2ListOfEdges(&adj);
1910      output->m[1].rtyp = LIST_CMD;
1911      output->m[1].data = (void*) listOfEdges;
1912      delete p;
1913    }
1914    catch (const std::exception& ex)
1915    {
1916      gfan::deinitializeCddlibIfRequired();
1917      WerrorS("ERROR: "); WerrorS(ex.what()); WerrorS("\n");
1918      return TRUE;
1919    }
1920    gfan::deinitializeCddlibIfRequired();
1921    res->rtyp = LIST_CMD;
1922    res->data = (void*) output;
1923    return FALSE;
1924  }
1925  WerrorS("vertexEdgeGraph: unexpected parameters");
1926  return TRUE;
1927}
1928
1929#include <omp.h>
1930// extern "C" void omp_set_num_threads(int num_threads);
1931
1932extern "C" int SI_MOD_INIT(polymake)(SModulFunctions* p)
1933{
1934  omp_set_num_threads(1); // avoid multiple threads within polymake/libnormaliz
1935  if (init_polymake==NULL)
1936    {init_polymake = new polymake::Main();}
1937  init_polymake->set_application("fan");
1938  // p->iiAddCproc("polymake.so","coneViaPoints",FALSE,PMconeViaRays);
1939  // p->iiAddCproc("polymake.so","polytopeViaPoints",FALSE,PMpolytopeViaVertices);
1940  p->iiAddCproc("polymakeInterface.lib","isLatticePolytope",FALSE,PMisLatticePolytope);
1941  p->iiAddCproc("polymakeInterface.lib","isBounded",FALSE,PMisBounded);
1942  p->iiAddCproc("polymakeInterface.lib","isReflexive",FALSE,PMisReflexive);
1943  p->iiAddCproc("polymakeInterface.lib","isGorenstein",FALSE,PMisGorenstein);
1944  p->iiAddCproc("polymakeInterface.lib","gorensteinIndex",FALSE,PMgorensteinIndex);
1945  p->iiAddCproc("polymakeInterface.lib","gorensteinVector",FALSE,PMgorensteinVector);
1946  p->iiAddCproc("polymakeInterface.lib","isCanonical",FALSE,PMisCanonical);
1947  p->iiAddCproc("polymakeInterface.lib","isTerminal",FALSE,PMisTerminal);
1948  p->iiAddCproc("polymakeInterface.lib","isLatticeEmpty",FALSE,PMisLatticeEmpty);
1949  p->iiAddCproc("polymakeInterface.lib","latticeVolume",FALSE,PMlatticeVolume);
1950  p->iiAddCproc("polymakeInterface.lib","latticeDegree",FALSE,PMlatticeDegree);
1951  p->iiAddCproc("polymakeInterface.lib","latticeCodegree",FALSE,PMlatticeCodegree);
1952  p->iiAddCproc("polymakeInterface.lib","ehrhartPolynomialCoeff",FALSE,PMehrhartPolynomialCoeff);
1953  p->iiAddCproc("polymakeInterface.lib","fVectorP",FALSE,PMfVector);
1954  p->iiAddCproc("polymakeInterface.lib","hVector",FALSE,PMhVector);
1955  p->iiAddCproc("polymakeInterface.lib","hStarVector",FALSE,PMhStarVector);
1956  p->iiAddCproc("polymakeInterface.lib","isNormal",FALSE,PMisNormal);
1957  p->iiAddCproc("polymakeInterface.lib","facetWidths",FALSE,PMfacetWidths);
1958  p->iiAddCproc("polymakeInterface.lib","facetWidth",FALSE,PMfacetWidth);
1959  p->iiAddCproc("polymakeInterface.lib","facetVertexLatticeDistances",FALSE,PMfacetVertexLatticeDistances);
1960  p->iiAddCproc("polymakeInterface.lib","isCompressed",FALSE,PMisCompressed);
1961  p->iiAddCproc("polymakeInterface.lib","isSmooth",FALSE,PMisSmooth);
1962  p->iiAddCproc("polymakeInterface.lib","isVeryAmple",FALSE,PMisVeryAmple);
1963  p->iiAddCproc("polymakeInterface.lib","latticePoints",FALSE,PMlatticePoints);
1964  p->iiAddCproc("polymakeInterface.lib","nLatticePoints",FALSE,PMnLatticePoints);
1965  p->iiAddCproc("polymakeInterface.lib","interiorLatticePoints",FALSE,PMinteriorLatticePoints);
1966  p->iiAddCproc("polymakeInterface.lib","nInteriorLatticePoints",FALSE,PMnInteriorLatticePoints);
1967  p->iiAddCproc("polymakeInterface.lib","boundaryLatticePoints",FALSE,PMboundaryLatticePoints);
1968  p->iiAddCproc("polymakeInterface.lib","nBoundaryLatticePoints",FALSE,PMnBoundaryLatticePoints);
1969  p->iiAddCproc("polymakeInterface.lib","hilbertBasis",FALSE,PMhilbertBasis);
1970  p->iiAddCproc("polymakeInterface.lib","nHilbertBasis",FALSE,PMnHilbertBasis);
1971  p->iiAddCproc("polymakeInterface.lib","minkowskiSum",FALSE,PMminkowskiSum);
1972  p->iiAddCproc("polymakeInterface.lib","maximalFace",FALSE,PMmaximalFace);
1973  p->iiAddCproc("polymakeInterface.lib","minimalFace",FALSE,PMminimalFace);
1974  p->iiAddCproc("polymakeInterface.lib","maximalValue",FALSE,PMmaximalValue);
1975  p->iiAddCproc("polymakeInterface.lib","minimalValue",FALSE,PMminimalValue);
1976  p->iiAddCproc("polymakeInterface.lib","visual",FALSE,visual);
1977  p->iiAddCproc("polymakeInterface.lib","normalFan",FALSE,normalFan);
1978  p->iiAddCproc("polymakeInterface.lib","vertexAdjacencyGraph",FALSE,PMvertexAdjacencyGraph);
1979  p->iiAddCproc("polymakeInterface.lib","vertexEdgeGraph",FALSE,PMvertexEdgeGraph);
1980
1981  blackbox* b=getBlackboxStuff(polytopeID);
1982  b->blackbox_Op2=bbpolytope_Op2;
1983
1984  init_polymake_help();
1985  return MAX_TOK;
1986}
1987
1988#endif /* HAVE_POLYMAKE */
Note: See TracBrowser for help on using the repository browser.