Functions | Variables
bbcone.cc File Reference
#include <kernel/mod2.h>
#include <misc/intvec.h>
#include <misc/sirandom.h>
#include <coeffs/bigintmat.h>
#include <coeffs/longrat.h>
#include <Singular/ipid.h>
#include <Singular/ipshell.h>
#include <Singular/blackbox.h>
#include <callgfanlib_conversion.h>
#include <sstream>
#include <gfanlib/gfanlib.h>
#include <gfanlib/gfanlib_q.h>
#include <bbfan.h>
#include <bbpolytope.h>

Go to the source code of this file.

Functions

std::string toString (const gfan::ZCone *const c)
 
void * bbcone_Init (blackbox *)
 
BOOLEAN bbcone_Assign (leftv l, leftv r)
 
char * bbcone_String (blackbox *, void *d)
 
void bbcone_destroy (blackbox *, void *d)
 
void * bbcone_Copy (blackbox *, void *d)
 
static BOOLEAN bbcone_Op2 (int op, leftv res, leftv i1, leftv i2)
 
static BOOLEAN jjCONENORMALS1 (leftv res, leftv v)
 
static BOOLEAN jjCONENORMALS2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCONENORMALS3 (leftv res, leftv u, leftv v, leftv w)
 
BOOLEAN coneViaNormals (leftv res, leftv args)
 
static BOOLEAN jjCONERAYS1 (leftv res, leftv v)
 
static BOOLEAN jjCONERAYS2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCONERAYS3 (leftv res, leftv u, leftv v, leftv w)
 
BOOLEAN coneViaRays (leftv res, leftv args)
 
BOOLEAN inequalities (leftv res, leftv args)
 
BOOLEAN equations (leftv res, leftv args)
 
BOOLEAN facets (leftv res, leftv args)
 
BOOLEAN impliedEquations (leftv res, leftv args)
 
BOOLEAN generatorsOfSpan (leftv res, leftv args)
 
BOOLEAN generatorsOfLinealitySpace (leftv res, leftv args)
 
BOOLEAN rays (leftv res, leftv args)
 
BOOLEAN quotientLatticeBasis (leftv res, leftv args)
 
BOOLEAN getLinearForms (leftv res, leftv args)
 
BOOLEAN ambientDimension (leftv res, leftv args)
 
BOOLEAN dimension (leftv res, leftv args)
 
BOOLEAN codimension (leftv res, leftv args)
 
BOOLEAN linealityDimension (leftv res, leftv args)
 
BOOLEAN getMultiplicity (leftv res, leftv args)
 
BOOLEAN isOrigin (leftv res, leftv args)
 
BOOLEAN isFullSpace (leftv res, leftv args)
 
BOOLEAN isSimplicial (leftv res, leftv args)
 
BOOLEAN containsPositiveVector (leftv res, leftv args)
 
BOOLEAN linealitySpace (leftv res, leftv args)
 
BOOLEAN dualCone (leftv res, leftv args)
 
BOOLEAN negatedCone (leftv res, leftv args)
 
BOOLEAN semigroupGenerator (leftv res, leftv args)
 
BOOLEAN relativeInteriorPoint (leftv res, leftv args)
 
BOOLEAN uniquePoint (leftv res, leftv args)
 
gfan::ZVector randomPoint (const gfan::ZCone *zc)
 
BOOLEAN randomPoint (leftv res, leftv args)
 
BOOLEAN setMultiplicity (leftv res, leftv args)
 
BOOLEAN setLinearForms (leftv res, leftv args)
 
gfan::ZMatrix liftUp (const gfan::ZMatrix &zm)
 
gfan::ZCone liftUp (const gfan::ZCone &zc)
 
BOOLEAN coneToPolytope (leftv res, leftv args)
 
BOOLEAN intersectCones (leftv res, leftv args)
 
BOOLEAN convexHull (leftv res, leftv args)
 
BOOLEAN coneLink (leftv res, leftv args)
 
BOOLEAN containsInSupport (leftv res, leftv args)
 
BOOLEAN containsRelatively (leftv res, leftv args)
 
BOOLEAN hasFace (leftv res, leftv args)
 
BOOLEAN canonicalizeCone (leftv res, leftv args)
 
BOOLEAN containsCone (leftv res, leftv args)
 
lists listOfFacets (const gfan::ZCone &zc)
 
BOOLEAN listOfFacets (leftv res, leftv args)
 
gfan::ZVector * facetContaining (gfan::ZCone *zc, gfan::ZVector *zv)
 
BOOLEAN facetContaining (leftv res, leftv args)
 
gfan::ZMatrix interiorPointsOfFacets (const gfan::ZCone &zc, const std::set< gfan::ZVector > &exceptThese)
 
std::pair< gfan::ZMatrix, gfan::ZMatrix > interiorPointsAndNormalsOfFacets (const gfan::ZCone zc, const std::set< gfan::ZVector > &exceptThesePoints, const bool onlyLowerHalfSpace)
 
void bbcone_setup (SModulFunctions *p)
 

Variables

int coneID
 

Function Documentation

BOOLEAN ambientDimension ( leftv  res,
leftv  args 
)

Definition at line 671 of file bbcone.cc.

672 {
673  leftv u=args;
674  if ((u != NULL) && (u->Typ() == coneID))
675  {
676  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
677  res->rtyp = INT_CMD;
678  res->data = (void*) (long) zc->ambientDimension();
679  return FALSE;
680  }
681  if ((u != NULL) && (u->Typ() == fanID))
682  {
683  gfan::ZFan* zf = (gfan::ZFan*)u->Data();
684  res->rtyp = INT_CMD;
685  res->data = (void*) (long) getAmbientDimension(zf);
686  return FALSE;
687  }
688  if ((u != NULL) && (u->Typ() == polytopeID))
689  {
690  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
691  res->rtyp = INT_CMD;
692  res->data = (void*) (long) getAmbientDimension(zc);
693  return FALSE;
694  }
695  WerrorS("ambientDimension: unexpected parameters");
696  return TRUE;
697 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int fanID
Definition: bbfan.cc:18
int Typ()
Definition: subexpr.cc:955
int getAmbientDimension(gfan::ZFan *zf)
Definition: bbfan.cc:242
void * data
Definition: subexpr.h:89
int polytopeID
Definition: bbpolytope.cc:17
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN bbcone_Assign ( leftv  l,
leftv  r 
)

Definition at line 84 of file bbcone.cc.

85 {
86  gfan::ZCone* newZc;
87  if (r==NULL)
88  {
89  if (l->Data()!=NULL)
90  {
91  gfan::ZCone* zd = (gfan::ZCone*)l->Data();
92  delete zd;
93  }
94  newZc = new gfan::ZCone();
95  }
96  else if (r->Typ()==l->Typ())
97  {
98  if (l->Data()!=NULL)
99  {
100  gfan::ZCone* zd = (gfan::ZCone*)l->Data();
101  delete zd;
102  }
103  newZc = (gfan::ZCone*)r->CopyD();
104  }
105  else if (r->Typ()==INT_CMD)
106  {
107  int ambientDim = (int)(long)r->Data();
108  if (ambientDim < 0)
109  {
110  Werror("expected an int >= 0, but got %d", ambientDim);
111  return TRUE;
112  }
113  if (l->Data()!=NULL)
114  {
115  gfan::ZCone* zd = (gfan::ZCone*)l->Data();
116  delete zd;
117  }
118  newZc = new gfan::ZCone(ambientDim);
119  }
120  else
121  {
122  Werror("assign Type(%d) = Type(%d) not implemented",l->Typ(),r->Typ());
123  return TRUE;
124  }
125 
126  if (l->rtyp==IDHDL)
127  {
128  IDDATA((idhdl)l->data)=(char*) newZc;
129  }
130  else
131  {
132  l->data=(void *)newZc;
133  }
134  return FALSE;
135 }
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int Typ()
Definition: subexpr.cc:955
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
#define IDDATA(a)
Definition: ipid.h:125
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void * CopyD(int t)
Definition: subexpr.cc:662
void* bbcone_Copy ( blackbox *  ,
void *  d 
)

Definition at line 156 of file bbcone.cc.

157 {
158  gfan::ZCone* zc = (gfan::ZCone*)d;
159  gfan::ZCone* newZc = new gfan::ZCone(*zc);
160  return newZc;
161 }
void bbcone_destroy ( blackbox *  ,
void *  d 
)

Definition at line 147 of file bbcone.cc.

148 {
149  if (d!=NULL)
150  {
151  gfan::ZCone* zc = (gfan::ZCone*) d;
152  delete zc;
153  }
154 }
#define NULL
Definition: omList.c:10
void* bbcone_Init ( blackbox *  )

Definition at line 79 of file bbcone.cc.

80 {
81  return (void*)(new gfan::ZCone());
82 }
static BOOLEAN bbcone_Op2 ( int  op,
leftv  res,
leftv  i1,
leftv  i2 
)
static

Definition at line 163 of file bbcone.cc.

164 {
165  gfan::ZCone* zp = (gfan::ZCone*) i1->Data();
166  switch(op)
167  {
168  case '&':
169  {
170  if (i2->Typ()==coneID)
171  {
172  gfan::ZCone* zq = (gfan::ZCone*) i2->Data();
173  int d1 = zp->ambientDimension();
174  int d2 = zq->ambientDimension();
175  if (d1 != d2)
176  {
177  WerrorS("mismatching ambient dimensions");
178  return TRUE;
179  }
180  gfan::ZCone* zs = new gfan::ZCone();
181  *zs = gfan::intersection(*zp, *zq);
182  zs->canonicalize();
183  res->rtyp = coneID;
184  res->data = (void*) zs;
185  return FALSE;
186  }
187  return blackboxDefaultOp2(op,res,i1,i2);
188  }
189  case '|':
190  {
191  if(i2->Typ()==coneID)
192  {
193  gfan::ZCone* zq = (gfan::ZCone*) i2->Data();
194  int d1 = zp->ambientDimension();
195  int d2 = zq->ambientDimension();
196  if (d1 != d2)
197  {
198  WerrorS("mismatching ambient dimensions");
199  return TRUE;
200  }
201  gfan::ZMatrix rays = zp->extremeRays();
202  rays.append(zq->extremeRays());
203  gfan::ZMatrix lineality = zp->generatorsOfLinealitySpace();
204  lineality.append(zq->generatorsOfLinealitySpace());
205  gfan::ZCone* zs = new gfan::ZCone();
206  *zs = gfan::ZCone::givenByRays(rays,lineality);
207  zs->canonicalize();
208  res->rtyp = coneID;
209  res->data = (void*) zs;
210  return FALSE;
211  }
212  return blackboxDefaultOp2(op,res,i1,i2);
213  }
214  case EQUAL_EQUAL:
215  {
216  if(i2->Typ()==coneID)
217  {
218  gfan::ZCone* zq = (gfan::ZCone*) i2->Data();
219  zp->canonicalize();
220  zq->canonicalize();
221  bool b = !((*zp)!=(*zq));
222  res->rtyp = INT_CMD;
223  res->data = (void*) b;
224  return FALSE;
225  }
226  return blackboxDefaultOp2(op,res,i1,i2);
227  }
228  default:
229  return blackboxDefaultOp2(op,res,i1,i2);
230  }
231  return blackboxDefaultOp2(op,res,i1,i2);
232 }
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
BOOLEAN blackboxDefaultOp2(int op, leftv, leftv r1, leftv)
default procedure blackboxDefaultOp2, to be called as "default:" branch
Definition: blackbox.cc:85
int coneID
Definition: bbcone.cc:24
BOOLEAN rays(leftv res, leftv args)
Definition: bbcone.cc:618
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
const poly b
Definition: syzextra.cc:213
void bbcone_setup ( SModulFunctions p)

Definition at line 1787 of file bbcone.cc.

1788 {
1789  blackbox *b=(blackbox*)omAlloc0(sizeof(blackbox));
1790  // all undefined entries will be set to default in setBlackboxStuff
1791  // the default Print is quite usefull,
1792  // all other are simply error messages
1793  b->blackbox_destroy=bbcone_destroy;
1794  b->blackbox_String=bbcone_String;
1795  // b->blackbox_Print=blackbox_default_Print;
1796  b->blackbox_Init=bbcone_Init;
1797  b->blackbox_Copy=bbcone_Copy;
1798  b->blackbox_Assign=bbcone_Assign;
1799  b->blackbox_Op2=bbcone_Op2;
1800  //b->blackbox_serialize=bbcone_serialize;
1801  //b->blackbox_deserialize=bbcone_deserialize;
1802  p->iiAddCproc("","coneViaInequalities",FALSE,coneViaNormals);
1803  p->iiAddCproc("","coneViaPoints",FALSE,coneViaRays);
1804 
1805  // iiAddCproc("","makePolytope",FALSE,coneToPolytope);
1806  p->iiAddCproc("","ambientDimension",FALSE,ambientDimension);
1807  p->iiAddCproc("","canonicalizeCone",FALSE,canonicalizeCone);
1808  p->iiAddCproc("","codimension",FALSE,codimension);
1809  p->iiAddCproc("","coneLink",FALSE,coneLink);
1810  p->iiAddCproc("","containsAsFace",FALSE,hasFace);
1811  p->iiAddCproc("","containsInSupport",FALSE,containsInSupport);
1812  p->iiAddCproc("","containsPositiveVector",FALSE,containsPositiveVector);
1813  p->iiAddCproc("","containsRelatively",FALSE,containsRelatively);
1814  p->iiAddCproc("","convexHull",FALSE,convexHull);
1815  p->iiAddCproc("","convexIntersection",FALSE,intersectCones);
1816  p->iiAddCproc("","dimension",FALSE,dimension);
1817  p->iiAddCproc("","dualCone",FALSE,dualCone);
1818  p->iiAddCproc("","equations",FALSE,equations);
1819  p->iiAddCproc("","facets",FALSE,facets);
1820  p->iiAddCproc("","generatorsOfLinealitySpace",FALSE,generatorsOfLinealitySpace);
1821  p->iiAddCproc("","generatorsOfSpan",FALSE,generatorsOfSpan);
1822  p->iiAddCproc("","getLinearForms",FALSE,getLinearForms);
1823  p->iiAddCproc("","getMultiplicity",FALSE,getMultiplicity);
1824  p->iiAddCproc("","inequalities",FALSE,inequalities);
1825  p->iiAddCproc("","isFullSpace",FALSE,isFullSpace);
1826  p->iiAddCproc("","isOrigin",FALSE,isOrigin);
1827  p->iiAddCproc("","isSimplicial",FALSE,isSimplicial);
1828  p->iiAddCproc("","linealityDimension",FALSE,linealityDimension);
1829  p->iiAddCproc("","linealitySpace",FALSE,linealitySpace);
1830  p->iiAddCproc("","negatedCone",FALSE,negatedCone);
1831  p->iiAddCproc("","quotientLatticeBasis",FALSE,quotientLatticeBasis);
1832  p->iiAddCproc("","randomPoint",FALSE,randomPoint);
1833  p->iiAddCproc("","rays",FALSE,rays);
1834  p->iiAddCproc("","relativeInteriorPoint",FALSE,relativeInteriorPoint);
1835  p->iiAddCproc("","semigroupGenerator",FALSE,semigroupGenerator);
1836  p->iiAddCproc("","setLinearForms",FALSE,setLinearForms);
1837  p->iiAddCproc("","setMultiplicity",FALSE,setMultiplicity);
1838  p->iiAddCproc("","span",FALSE,impliedEquations);
1839  p->iiAddCproc("","uniquePoint",FALSE,uniquePoint);
1840  p->iiAddCproc("","listContainsCone",FALSE,containsCone);
1841  p->iiAddCproc("","listOfFacets",FALSE,listOfFacets);
1842  p->iiAddCproc("","facetContaining",FALSE,facetContaining);
1843  coneID=setBlackboxStuff(b,"cone");
1844 }
BOOLEAN isFullSpace(leftv res, leftv args)
Definition: bbcone.cc:806
BOOLEAN coneViaNormals(leftv res, leftv args)
Definition: bbcone.cc:351
BOOLEAN getMultiplicity(leftv res, leftv args)
Definition: bbcone.cc:776
BOOLEAN dualCone(leftv res, leftv args)
Definition: bbcone.cc:874
BOOLEAN containsPositiveVector(leftv res, leftv args)
Definition: bbcone.cc:844
BOOLEAN containsRelatively(leftv res, leftv args)
Definition: bbcone.cc:1379
BOOLEAN canonicalizeCone(leftv res, leftv args)
Definition: bbcone.cc:1453
#define FALSE
Definition: auxiliary.h:140
BOOLEAN quotientLatticeBasis(leftv res, leftv args)
Definition: bbcone.cc:641
BOOLEAN generatorsOfSpan(leftv res, leftv args)
Definition: bbcone.cc:588
gfan::ZVector * facetContaining(gfan::ZCone *zc, gfan::ZVector *zv)
Definition: bbcone.cc:1567
BOOLEAN coneViaRays(leftv res, leftv args)
Definition: bbcone.cc:506
BOOLEAN containsInSupport(leftv res, leftv args)
Definition: bbcone.cc:1321
static BOOLEAN bbcone_Op2(int op, leftv res, leftv i1, leftv i2)
Definition: bbcone.cc:163
gfan::ZVector randomPoint(const gfan::ZCone *zc)
Definition: bbcone.cc:956
BOOLEAN inequalities(leftv res, leftv args)
Definition: bbcone.cc:527
BOOLEAN linealitySpace(leftv res, leftv args)
Definition: bbcone.cc:859
BOOLEAN relativeInteriorPoint(leftv res, leftv args)
Definition: bbcone.cc:926
BOOLEAN semigroupGenerator(leftv res, leftv args)
Definition: bbcone.cc:904
BOOLEAN isSimplicial(leftv res, leftv args)
Definition: bbcone.cc:821
BOOLEAN codimension(leftv res, leftv args)
Definition: bbcone.cc:727
BOOLEAN coneLink(leftv res, leftv args)
Definition: bbcone.cc:1276
BOOLEAN negatedCone(leftv res, leftv args)
Definition: bbcone.cc:889
BOOLEAN getLinearForms(leftv res, leftv args)
Definition: bbcone.cc:656
int coneID
Definition: bbcone.cc:24
lists listOfFacets(const gfan::ZCone &zc)
Definition: bbcone.cc:1506
BOOLEAN rays(leftv res, leftv args)
Definition: bbcone.cc:618
void bbcone_destroy(blackbox *, void *d)
Definition: bbcone.cc:147
BOOLEAN dimension(leftv res, leftv args)
Definition: bbcone.cc:699
void * bbcone_Init(blackbox *)
Definition: bbcone.cc:79
BOOLEAN containsCone(leftv res, leftv args)
Definition: bbcone.cc:1469
BOOLEAN uniquePoint(leftv res, leftv args)
Definition: bbcone.cc:941
BOOLEAN equations(leftv res, leftv args)
Definition: bbcone.cc:543
BOOLEAN facets(leftv res, leftv args)
Definition: bbcone.cc:558
BOOLEAN setLinearForms(leftv res, leftv args)
Definition: bbcone.cc:1012
BOOLEAN ambientDimension(leftv res, leftv args)
Definition: bbcone.cc:671
char * bbcone_String(blackbox *, void *d)
Definition: bbcone.cc:137
BOOLEAN isOrigin(leftv res, leftv args)
Definition: bbcone.cc:791
BOOLEAN bbcone_Assign(leftv l, leftv r)
Definition: bbcone.cc:84
BOOLEAN linealityDimension(leftv res, leftv args)
Definition: bbcone.cc:755
int(* iiAddCproc)(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: ipid.h:73
BOOLEAN generatorsOfLinealitySpace(leftv res, leftv args)
Definition: bbcone.cc:603
BOOLEAN impliedEquations(leftv res, leftv args)
Definition: bbcone.cc:573
BOOLEAN hasFace(leftv res, leftv args)
Definition: bbcone.cc:1420
BOOLEAN intersectCones(leftv res, leftv args)
Definition: bbcone.cc:1081
int setBlackboxStuff(blackbox *bb, const char *n)
define a new type
Definition: blackbox.cc:128
const poly b
Definition: syzextra.cc:213
void * bbcone_Copy(blackbox *, void *d)
Definition: bbcone.cc:156
#define omAlloc0(size)
Definition: omAllocDecl.h:211
BOOLEAN setMultiplicity(leftv res, leftv args)
Definition: bbcone.cc:992
char* bbcone_String ( blackbox *  ,
void *  d 
)

Definition at line 137 of file bbcone.cc.

138 {
139  if (d==NULL) return omStrDup("invalid object");
140  else
141  {
142  std::string s=toString((gfan::ZCone*) d);
143  return omStrDup(s.c_str());
144  }
145 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define string
Definition: libparse.cc:1250
#define NULL
Definition: omList.c:10
std::string toString(const gfan::ZCone *const c)
Definition: bbcone.cc:26
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN canonicalizeCone ( leftv  res,
leftv  args 
)

Definition at line 1453 of file bbcone.cc.

1454 {
1455  leftv u=args;
1456  if ((u != NULL) && (u->Typ() == coneID))
1457  {
1458  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
1459  gfan::ZCone* zd = new gfan::ZCone(*zc);
1460  zd->canonicalize();
1461  res->rtyp = coneID;
1462  res->data = (void*) zd;
1463  return FALSE;
1464  }
1465  WerrorS("canonicalizeCone: unexpected parameters");
1466  return TRUE;
1467 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN codimension ( leftv  res,
leftv  args 
)

Definition at line 727 of file bbcone.cc.

728 {
729  leftv u=args;
730  if ((u != NULL) && (u->Typ() == coneID))
731  {
732  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
733  res->rtyp = INT_CMD;
734  res->data = (void*) (long) zc->codimension();
735  return FALSE;
736  }
737  if ((u != NULL) && (u->Typ() == fanID))
738  {
739  gfan::ZFan* zf = (gfan::ZFan*)u->Data();
740  res->rtyp = INT_CMD;
741  res->data = (void*) (long) getCodimension(zf);
742  return FALSE;
743  }
744  if ((u != NULL) && (u->Typ() == polytopeID))
745  {
746  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
747  res->rtyp = INT_CMD;
748  res->data = (void*) (long) getCodimension(zc);
749  return FALSE;
750  }
751  WerrorS("getCodimension: unexpected parameters");
752  return TRUE;
753 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int fanID
Definition: bbfan.cc:18
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int polytopeID
Definition: bbpolytope.cc:17
int coneID
Definition: bbcone.cc:24
int getCodimension(gfan::ZFan *zf)
Definition: bbfan.cc:247
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN coneLink ( leftv  res,
leftv  args 
)

Definition at line 1276 of file bbcone.cc.

1277 {
1278  leftv u = args;
1279  if ((u != NULL) && (u->Typ() == coneID))
1280  {
1281  leftv v = u->next;
1282  if ((v != NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTVEC_CMD)))
1283  {
1284  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
1285  bigintmat* iv = NULL;
1286  if (v->Typ() == INTVEC_CMD)
1287  {
1288  intvec* iv0 = (intvec*) v->Data();
1289  iv = iv2bim(iv0,coeffs_BIGINT)->transpose();
1290  }
1291  else
1292  iv = (bigintmat*)v->Data();
1293  gfan::ZVector* zv = bigintmatToZVector(iv);
1294  int d1 = zc->ambientDimension();
1295  int d2 = zv->size();
1296  if (d1 != d2)
1297  {
1298  Werror("expected ambient dim of cone and size of vector\n"
1299  " to be equal but got %d and %d", d1, d2);
1300  return TRUE;
1301  }
1302  if(!zc->contains(*zv))
1303  {
1304  WerrorS("the provided intvec does not lie in the cone");
1305  return TRUE;
1306  }
1307  gfan::ZCone* zd = new gfan::ZCone(zc->link(*zv));
1308  res->rtyp = coneID;
1309  res->data = (void *) zd;
1310 
1311  delete zv;
1312  if (v->Typ() == INTMAT_CMD)
1313  delete iv;
1314  return FALSE;
1315  }
1316  }
1317  WerrorS("coneLink: unexpected parameters");
1318  return TRUE;
1319 }
bigintmat * transpose()
Definition: bigintmat.cc:38
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
Matrices of numbers.
Definition: bigintmat.h:32
bigintmat * iv2bim(intvec *b, const coeffs C)
Definition: bigintmat.cc:349
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
int coneID
Definition: bbcone.cc:24
Definition: tok.h:88
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
void Werror(const char *fmt,...)
Definition: reporter.cc:199
gfan::ZVector * bigintmatToZVector(const bigintmat &bim)
BOOLEAN coneToPolytope ( leftv  res,
leftv  args 
)

Definition at line 1064 of file bbcone.cc.

1065 {
1066  leftv u = args;
1067  if ((u != NULL) && (u->Typ() == coneID))
1068  {
1069  gfan::ZCone* zc = (gfan::ZCone*) u->Data();
1070  gfan::ZMatrix ineq=zc->getInequalities();
1071  gfan::ZMatrix eq=zc->getEquations();
1072  gfan::ZCone* zd = new gfan::ZCone(liftUp(ineq),liftUp(eq));
1073  res->rtyp = polytopeID;
1074  res->data = (void*) zd;
1075  return FALSE;
1076  }
1077  WerrorS("makePolytope: unexpected parameters");
1078  return TRUE;
1079 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
gfan::ZMatrix liftUp(const gfan::ZMatrix &zm)
Definition: bbcone.cc:1044
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int polytopeID
Definition: bbpolytope.cc:17
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN coneViaNormals ( leftv  res,
leftv  args 
)

Definition at line 351 of file bbcone.cc.

352 {
353  leftv u = args;
354  if ((u != NULL) && ((u->Typ() == BIGINTMAT_CMD) || (u->Typ() == INTMAT_CMD)))
355  {
356  if (u->next == NULL) return jjCONENORMALS1(res, u);
357  }
358  leftv v = u->next;
359  if ((v != NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTMAT_CMD)))
360  {
361  if (v->next == NULL) return jjCONENORMALS2(res, u, v);
362  }
363  leftv w = v->next;
364  if ((w != NULL) && (w->Typ() == INT_CMD))
365  {
366  if (w->next == NULL) return jjCONENORMALS3(res, u, v, w);
367  }
368  WerrorS("coneViaInequalities: unexpected parameters");
369  return TRUE;
370 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
leftv next
Definition: subexpr.h:87
static BOOLEAN jjCONENORMALS2(leftv res, leftv u, leftv v)
Definition: bbcone.cc:258
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
static BOOLEAN jjCONENORMALS3(leftv res, leftv u, leftv v, leftv w)
Definition: bbcone.cc:301
const CanonicalForm & w
Definition: facAbsFact.cc:55
static BOOLEAN jjCONENORMALS1(leftv res, leftv v)
Definition: bbcone.cc:236
BOOLEAN coneViaRays ( leftv  res,
leftv  args 
)

Definition at line 506 of file bbcone.cc.

507 {
508  leftv u = args;
509  if ((u != NULL) && ((u->Typ() == BIGINTMAT_CMD) || (u->Typ() == INTMAT_CMD)))
510  {
511  if (u->next == NULL) return jjCONERAYS1(res, u);
512  leftv v = u->next;
513  if ((v != NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTMAT_CMD)))
514  {
515  if (v->next == NULL) return jjCONERAYS2(res, u, v);
516  leftv w = v->next;
517  if ((w != NULL) && (w->Typ() == INT_CMD))
518  {
519  if (w->next == NULL) return jjCONERAYS3(res, u, v, w);
520  }
521  }
522  }
523  WerrorS("coneViaPoints: unexpected parameters");
524  return TRUE;
525 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
static BOOLEAN jjCONERAYS1(leftv res, leftv v)
Definition: bbcone.cc:372
static BOOLEAN jjCONERAYS2(leftv res, leftv u, leftv v)
Definition: bbcone.cc:399
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
static BOOLEAN jjCONERAYS3(leftv res, leftv u, leftv v, leftv w)
Definition: bbcone.cc:447
const CanonicalForm & w
Definition: facAbsFact.cc:55
BOOLEAN containsCone ( leftv  res,
leftv  args 
)

Definition at line 1469 of file bbcone.cc.

1470 {
1471  leftv u=args;
1472  if ((u != NULL) && (u->Typ() == LIST_CMD))
1473  {
1474  leftv v=u->next;
1475  if ((v != NULL) && (v->Typ() == coneID))
1476  {
1477  lists l = (lists) u->Data();
1478  gfan::ZCone* zc = (gfan::ZCone*) v->Data();
1479  zc->canonicalize();
1480  int b = 0;
1481  for (int i=0; i<=lSize(l); i++)
1482  {
1483  if (l->m[i].Typ() != coneID)
1484  {
1485  WerrorS("containsCone: entries of wrong type in list");
1486  return TRUE;
1487  }
1488  gfan::ZCone* ll = (gfan::ZCone*) l->m[i].Data();
1489  ll->canonicalize();
1490  if (!((*ll) != (*zc)))
1491  {
1492  b = 1;
1493  break;
1494  }
1495  }
1496  res->rtyp = INT_CMD;
1497  res->data = (char*) (long) b;
1498  return FALSE;
1499  }
1500  }
1501  WerrorS("containsCone: unexpected parameters");
1502  return TRUE;
1503 }
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
int i
Definition: cfEzgcd.cc:123
int lSize(lists L)
Definition: lists.cc:25
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
Definition: tok.h:96
const poly b
Definition: syzextra.cc:213
int l
Definition: cfEzgcd.cc:94
BOOLEAN containsInSupport ( leftv  res,
leftv  args 
)

Definition at line 1321 of file bbcone.cc.

1322 {
1323  leftv u=args;
1324  if ((u != NULL) && (u->Typ() == coneID))
1325  {
1326  leftv v=u->next;
1327  if ((v != NULL) && (v->Typ() == coneID))
1328  {
1329  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
1330  gfan::ZCone* zd = (gfan::ZCone*)v->Data();
1331  int d1 = zc->ambientDimension();
1332  int d2 = zd->ambientDimension();
1333  if (d1 != d2)
1334  {
1335  Werror("expected cones with same ambient dimensions\n but got"
1336  " dimensions %d and %d", d1, d2);
1337  return TRUE;
1338  }
1339  bool b = (zc->contains(*zd) ? 1 : 0);
1340  res->rtyp = INT_CMD;
1341  res->data = (void*) (long) b;
1342  return FALSE;
1343  }
1344  if ((v != NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTVEC_CMD)))
1345  {
1346  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
1347  bigintmat* iv = NULL;
1348  if (v->Typ() == INTVEC_CMD)
1349  {
1350  intvec* iv0 = (intvec*) v->Data();
1351  iv = iv2bim(iv0,coeffs_BIGINT)->transpose();
1352  }
1353  else
1354  iv = (bigintmat*)v->Data();
1355 
1356  gfan::ZVector* zv = bigintmatToZVector(iv);
1357  int d1 = zc->ambientDimension();
1358  int d2 = zv->size();
1359  if (d1 != d2)
1360  {
1361  Werror("expected cones with same ambient dimensions\n but got"
1362  " dimensions %d and %d", d1, d2);
1363  return TRUE;
1364  }
1365  int b = zc->contains(*zv);
1366  res->rtyp = INT_CMD;
1367  res->data = (void*) (long) b;
1368 
1369  delete zv;
1370  if (v->Typ() == INTMAT_CMD)
1371  delete iv;
1372  return FALSE;
1373  }
1374  }
1375  WerrorS("containsInSupport: unexpected parameters");
1376  return TRUE;
1377 }
bigintmat * transpose()
Definition: bigintmat.cc:38
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
Matrices of numbers.
Definition: bigintmat.h:32
bigintmat * iv2bim(intvec *b, const coeffs C)
Definition: bigintmat.cc:349
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
int coneID
Definition: bbcone.cc:24
Definition: tok.h:88
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:199
gfan::ZVector * bigintmatToZVector(const bigintmat &bim)
BOOLEAN containsPositiveVector ( leftv  res,
leftv  args 
)

Definition at line 844 of file bbcone.cc.

845 {
846  leftv u = args;
847  if ((u != NULL) && (u->Typ() == coneID))
848  {
849  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
850  int i = zc->containsPositiveVector();
851  res->rtyp = INT_CMD;
852  res->data = (void*) (long) i;
853  return FALSE;
854  }
855  WerrorS("containsPositiveVector: unexpected parameters");
856  return TRUE;
857 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN containsRelatively ( leftv  res,
leftv  args 
)

Definition at line 1379 of file bbcone.cc.

1380 {
1381  leftv u = args;
1382  if ((u != NULL) && (u->Typ() == coneID))
1383  {
1384  leftv v = u->next;
1385  if ((v != NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTVEC_CMD)))
1386  {
1387  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
1388  bigintmat* iv = NULL;
1389  if (v->Typ() == INTVEC_CMD)
1390  {
1391  intvec* iv0 = (intvec*) v->Data();
1392  iv = iv2bim(iv0,coeffs_BIGINT)->transpose();
1393  }
1394  else
1395  iv = (bigintmat*)v->Data();
1396  gfan::ZVector* zv = bigintmatToZVector(iv);
1397  int d1 = zc->ambientDimension();
1398  int d2 = zv->size();
1399  if (d1 == d2)
1400  {
1401  bool b = (zc->containsRelatively(*zv) ? 1 : 0);
1402  res->rtyp = INT_CMD;
1403  res->data = (void *) b;
1404  delete zv;
1405  if (v->Typ() == INTMAT_CMD)
1406  delete iv;
1407  return FALSE;
1408  }
1409  delete zv;
1410  if (v->Typ() == INTMAT_CMD)
1411  delete iv;
1412  Werror("expected ambient dim of cone and size of vector\n"
1413  "to be equal but got %d and %d", d1, d2);
1414  }
1415  }
1416  WerrorS("containsRelatively: unexpected parameters");
1417  return TRUE;
1418 }
bigintmat * transpose()
Definition: bigintmat.cc:38
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
Matrices of numbers.
Definition: bigintmat.h:32
bigintmat * iv2bim(intvec *b, const coeffs C)
Definition: bigintmat.cc:349
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
int coneID
Definition: bbcone.cc:24
Definition: tok.h:88
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:199
gfan::ZVector * bigintmatToZVector(const bigintmat &bim)
BOOLEAN convexHull ( leftv  res,
leftv  args 
)

Definition at line 1170 of file bbcone.cc.

1171 {
1172  leftv u = args;
1173  if ((u != NULL) && (u->Typ() == coneID))
1174  {
1175  leftv v = u->next;
1176  if ((v != NULL) && (v->Typ() == coneID))
1177  {
1178  gfan::ZCone* zc1 = (gfan::ZCone*)u->Data();
1179  gfan::ZCone* zc2 = (gfan::ZCone*)v->Data();
1180  int d1 = zc1->ambientDimension();
1181  int d2 = zc2->ambientDimension();
1182  if (d1 != d2)
1183  {
1184  Werror("expected ambient dims of both cones to coincide\n"
1185  "but got %d and %d", d1, d2);
1186  return TRUE;
1187  }
1188  gfan::ZMatrix zm1 = zc1->extremeRays();
1189  gfan::ZMatrix zm2 = zc2->extremeRays();
1190  gfan::ZMatrix zn1 = zc1->generatorsOfLinealitySpace();
1191  gfan::ZMatrix zn2 = zc2->generatorsOfLinealitySpace();
1192  gfan::ZMatrix zm = combineOnTop(zm1,zm2);
1193  gfan::ZMatrix zn = combineOnTop(zn1,zn2);
1194  gfan::ZCone* zc = new gfan::ZCone();
1195  *zc = gfan::ZCone::givenByRays(zm, zn);
1196  res->rtyp = coneID;
1197  res->data = (void*) zc;
1198  return FALSE;
1199  }
1200  if ((v != NULL) && (v->Typ() == polytopeID))
1201  {
1202  gfan::ZCone* zc11 = (gfan::ZCone*)u->Data();
1203  gfan::ZCone zc1 = liftUp(*zc11);
1204  gfan::ZCone* zc2 = (gfan::ZCone*)v->Data();
1205  int d1 = zc1.ambientDimension()-1;
1206  int d2 = zc2->ambientDimension()-1;
1207  if (d1 != d2)
1208  {
1209  Werror("expected ambient dims of both cones to coincide\n"
1210  "but got %d and %d", d1, d2);
1211  return TRUE;
1212  }
1213  gfan::ZMatrix zm1 = zc1.extremeRays();
1214  gfan::ZMatrix zm2 = zc2->extremeRays();
1215  gfan::ZMatrix zn = zc1.generatorsOfLinealitySpace();
1216  gfan::ZMatrix zm = combineOnTop(zm1,zm2);
1217  gfan::ZCone* zc = new gfan::ZCone();
1218  *zc = gfan::ZCone::givenByRays(zm, zn);
1219  res->rtyp = polytopeID;
1220  res->data = (void*) zc;
1221  return FALSE;
1222  }
1223  }
1224  if ((u != NULL) && (u->Typ() == polytopeID))
1225  {
1226  leftv v = u->next;
1227  if ((v != NULL) && (v->Typ() == coneID))
1228  {
1229  gfan::ZCone* zc1 = (gfan::ZCone*)u->Data();
1230  gfan::ZCone* zc22 = (gfan::ZCone*)v->Data();
1231  gfan::ZCone zc2 = liftUp(*zc22);
1232  int d1 = zc1->ambientDimension()-1;
1233  int d2 = zc2.ambientDimension()-1;
1234  if (d1 != d2)
1235  {
1236  Werror("expected ambient dims of both cones to coincide\n"
1237  "but got %d and %d", d1, d2);
1238  return TRUE;
1239  }
1240  gfan::ZMatrix zm1 = zc1->extremeRays();
1241  gfan::ZMatrix zm2 = zc2.extremeRays();
1242  gfan::ZMatrix zn = zc2.generatorsOfLinealitySpace();
1243  gfan::ZMatrix zm = combineOnTop(zm1,zm2);
1244  gfan::ZCone* zc = new gfan::ZCone();
1245  *zc = gfan::ZCone::givenByRays(zm,gfan::ZMatrix(0, zm.getWidth()));
1246  res->rtyp = polytopeID;
1247  res->data = (void*) zc;
1248  return FALSE;
1249  }
1250  if ((v != NULL) && (v->Typ() == polytopeID))
1251  {
1252  gfan::ZCone* zc1 = (gfan::ZCone*)u->Data();
1253  gfan::ZCone* zc2 = (gfan::ZCone*)v->Data();
1254  int d1 = zc1->ambientDimension()-1;
1255  int d2 = zc2->ambientDimension()-1;
1256  if (d1 != d2)
1257  {
1258  Werror("expected ambient dims of both cones to coincide\n"
1259  "but got %d and %d", d1, d2);
1260  return TRUE;
1261  }
1262  gfan::ZMatrix zm1 = zc1->extremeRays();
1263  gfan::ZMatrix zm2 = zc2->extremeRays();
1264  gfan::ZMatrix zm = combineOnTop(zm1,zm2);
1265  gfan::ZCone* zc = new gfan::ZCone();
1266  *zc = gfan::ZCone::givenByRays(zm,gfan::ZMatrix(0, zm.getWidth()));
1267  res->rtyp = polytopeID;
1268  res->data = (void*) zc;
1269  return FALSE;
1270  }
1271  }
1272  WerrorS("convexHull: unexpected parameters");
1273  return TRUE;
1274 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
gfan::ZMatrix liftUp(const gfan::ZMatrix &zm)
Definition: bbcone.cc:1044
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int polytopeID
Definition: bbpolytope.cc:17
int coneID
Definition: bbcone.cc:24
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN dimension ( leftv  res,
leftv  args 
)

Definition at line 699 of file bbcone.cc.

700 {
701  leftv u=args;
702  if ((u != NULL) && (u->Typ() == coneID))
703  {
704  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
705  res->rtyp = INT_CMD;
706  res->data = (void*) (long) zc->dimension();
707  return FALSE;
708  }
709  if ((u != NULL) && (u->Typ() == fanID))
710  {
711  gfan::ZFan* zf = (gfan::ZFan*)u->Data();
712  res->rtyp = INT_CMD;
713  res->data = (void*) (long) getDimension(zf);
714  return FALSE;
715  }
716  if ((u != NULL) && (u->Typ() == polytopeID))
717  {
718  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
719  res->rtyp = INT_CMD;
720  res->data = (void*) (long) getDimension(zc);
721  return FALSE;
722  }
723  WerrorS("dimension: unexpected parameters");
724  return TRUE;
725 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int fanID
Definition: bbfan.cc:18
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int polytopeID
Definition: bbpolytope.cc:17
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
int getDimension(gfan::ZFan *zf)
Definition: bbfan.cc:252
BOOLEAN dualCone ( leftv  res,
leftv  args 
)

Definition at line 874 of file bbcone.cc.

875 {
876  leftv u = args;
877  if ((u != NULL) && (u->Typ() == coneID))
878  {
879  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
880  gfan::ZCone* zd = new gfan::ZCone(zc->dualCone());
881  res->rtyp = coneID;
882  res->data = (void*) zd;
883  return FALSE;
884  }
885  WerrorS("dual: unexpected parameters");
886  return TRUE;
887 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN equations ( leftv  res,
leftv  args 
)

Definition at line 543 of file bbcone.cc.

544 {
545  leftv u = args;
546  if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID))
547  {
548  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
549  gfan::ZMatrix zmat = zc->getEquations();
550  res->rtyp = BIGINTMAT_CMD;
551  res->data = (void*) zMatrixToBigintmat(zmat);
552  return FALSE;
553  }
554  WerrorS("equations: unexpected parameters");
555  return TRUE;
556 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
bigintmat * zMatrixToBigintmat(const gfan::ZMatrix &zm)
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int polytopeID
Definition: bbpolytope.cc:17
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
gfan::ZVector* facetContaining ( gfan::ZCone *  zc,
gfan::ZVector *  zv 
)

Definition at line 1567 of file bbcone.cc.

1568 {
1569  gfan::ZMatrix facets = zc->getFacets();
1570  for (int i=0; i<facets.getHeight(); i++)
1571  {
1572  gfan::ZVector facet = facets[i];
1573  if (dot(facet,*zv) == (long) 0)
1574  return new gfan::ZVector(facet);
1575  }
1576  return new gfan::ZVector(zc->ambientDimension());
1577 }
Definition: gfan.h:44
int i
Definition: cfEzgcd.cc:123
BOOLEAN facets(leftv res, leftv args)
Definition: bbcone.cc:558
BOOLEAN facetContaining ( leftv  res,
leftv  args 
)

Definition at line 1580 of file bbcone.cc.

1581 {
1582  leftv u = args;
1583  if ((u != NULL) && (u->Typ() == coneID))
1584  {
1585  leftv v = u->next;
1586  if ((v != NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTVEC_CMD)))
1587  {
1588  gfan::ZCone* zc = (gfan::ZCone*) u->Data();
1589 
1590  bigintmat* point1;
1591  if (v->Typ() == INTVEC_CMD)
1592  {
1593  intvec* point0 = (intvec*) v->Data();
1594  point1 = iv2bim(point0,coeffs_BIGINT)->transpose();
1595  }
1596  else
1597  point1 = (bigintmat*) v->Data();
1598 
1599  gfan::ZVector* point = bigintmatToZVector(*point1);
1600  gfan::ZVector* facet = facetContaining(zc, point);
1601 
1602  res->rtyp = BIGINTMAT_CMD;
1603  res->data = (void*) zVectorToBigintmat(*facet);
1604 
1605  delete facet;
1606  delete point;
1607  if (v->Typ() == INTVEC_CMD)
1608  delete point1;
1609  return FALSE;
1610  }
1611  }
1612  WerrorS("facetContaining: unexpected parameters");
1613  return TRUE;
1614 }
bigintmat * transpose()
Definition: bigintmat.cc:38
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
Matrices of numbers.
Definition: bigintmat.h:32
bigintmat * iv2bim(intvec *b, const coeffs C)
Definition: bigintmat.cc:349
Definition: gfan.h:44
gfan::ZVector * facetContaining(gfan::ZCone *zc, gfan::ZVector *zv)
Definition: bbcone.cc:1567
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
int coneID
Definition: bbcone.cc:24
Definition: tok.h:88
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
gfan::ZVector * bigintmatToZVector(const bigintmat &bim)
BOOLEAN facets ( leftv  res,
leftv  args 
)

Definition at line 558 of file bbcone.cc.

559 {
560  leftv u = args;
561  if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID))
562  {
563  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
564  gfan::ZMatrix zm = zc->getFacets();
565  res->rtyp = BIGINTMAT_CMD;
566  res->data = (void*) zMatrixToBigintmat(zm);
567  return FALSE;
568  }
569  WerrorS("facets: unexpected parameters");
570  return TRUE;
571 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
bigintmat * zMatrixToBigintmat(const gfan::ZMatrix &zm)
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int polytopeID
Definition: bbpolytope.cc:17
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN generatorsOfLinealitySpace ( leftv  res,
leftv  args 
)

Definition at line 603 of file bbcone.cc.

604 {
605  leftv u = args;
606  if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID))
607  {
608  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
609  gfan::ZMatrix zmat = zc->generatorsOfLinealitySpace();
610  res->rtyp = BIGINTMAT_CMD;
611  res->data = (void*) zMatrixToBigintmat(zmat);
612  return FALSE;
613  }
614  WerrorS("generatorsOfLinealitySpace: unexpected parameters");
615  return TRUE;
616 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
bigintmat * zMatrixToBigintmat(const gfan::ZMatrix &zm)
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int polytopeID
Definition: bbpolytope.cc:17
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN generatorsOfSpan ( leftv  res,
leftv  args 
)

Definition at line 588 of file bbcone.cc.

589 {
590  leftv u = args;
591  if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID))
592  {
593  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
594  gfan::ZMatrix zmat = zc->generatorsOfSpan();
595  res->rtyp = BIGINTMAT_CMD;
596  res->data = (void*) zMatrixToBigintmat(zmat);
597  return FALSE;
598  }
599  WerrorS("generatorsOfSpan: unexpected parameters");
600  return TRUE;
601 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
bigintmat * zMatrixToBigintmat(const gfan::ZMatrix &zm)
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int polytopeID
Definition: bbpolytope.cc:17
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN getLinearForms ( leftv  res,
leftv  args 
)

Definition at line 656 of file bbcone.cc.

657 {
658  leftv u = args;
659  if ((u != NULL) && (u->Typ() == coneID))
660  {
661  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
662  gfan::ZMatrix zmat = zc->getLinearForms();
663  res->rtyp = BIGINTMAT_CMD;
664  res->data = (void*) zMatrixToBigintmat(zmat);
665  return FALSE;
666  }
667  WerrorS("getLinearForms: unexpected parameters");
668  return TRUE;
669 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
bigintmat * zMatrixToBigintmat(const gfan::ZMatrix &zm)
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN getMultiplicity ( leftv  res,
leftv  args 
)

Definition at line 776 of file bbcone.cc.

777 {
778  leftv u = args;
779  if ((u != NULL) && (u->Typ() == coneID))
780  {
781  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
782  number i = integerToNumber(zc->getMultiplicity());
783  res->rtyp = BIGINT_CMD;
784  res->data = (void*) i;
785  return FALSE;
786  }
787  WerrorS("getMultiplicity: unexpected parameters");
788  return TRUE;
789 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
Definition: tok.h:42
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
number integerToNumber(const gfan::Integer &I)
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN hasFace ( leftv  res,
leftv  args 
)

Definition at line 1420 of file bbcone.cc.

1421 {
1422  leftv u=args;
1423  if ((u != NULL) && (u->Typ() == coneID))
1424  {
1425  leftv v=u->next;
1426  if ((v != NULL) && (v->Typ() == coneID))
1427  {
1428  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
1429  gfan::ZCone* zd = (gfan::ZCone*)v->Data();
1430  bool b = zc->hasFace(*zd);
1431  res->rtyp = INT_CMD;
1432  res->data = (void*) (long) b;
1433  return FALSE;
1434  }
1435  }
1436  if ((u != NULL) && (u->Typ() == polytopeID))
1437  {
1438  leftv v=u->next;
1439  if ((v != NULL) && (v->Typ() == polytopeID))
1440  {
1441  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
1442  gfan::ZCone* zd = (gfan::ZCone*)v->Data();
1443  bool b = zc->hasFace(*zd);
1444  res->rtyp = INT_CMD;
1445  res->data = (void*) (long) b;
1446  return FALSE;
1447  }
1448  }
1449  WerrorS("containsAsFace: unexpected parameters");
1450  return TRUE;
1451 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int polytopeID
Definition: bbpolytope.cc:17
int coneID
Definition: bbcone.cc:24
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
const poly b
Definition: syzextra.cc:213
BOOLEAN impliedEquations ( leftv  res,
leftv  args 
)

Definition at line 573 of file bbcone.cc.

574 {
575  leftv u = args;
576  if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID))
577  {
578  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
579  gfan::ZMatrix zmat = zc->getImpliedEquations();
580  res->rtyp = BIGINTMAT_CMD;
581  res->data = (void*) zMatrixToBigintmat(zmat);
582  return FALSE;
583  }
584  WerrorS("span: unexpected parameters");
585  return TRUE;
586 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
bigintmat * zMatrixToBigintmat(const gfan::ZMatrix &zm)
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int polytopeID
Definition: bbpolytope.cc:17
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN inequalities ( leftv  res,
leftv  args 
)

Definition at line 527 of file bbcone.cc.

528 {
529  leftv u = args;
530  if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID))
531  {
532  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
533 
534  gfan::ZMatrix zmat = zc->getInequalities();
535  res->rtyp = BIGINTMAT_CMD;
536  res->data = (void*) zMatrixToBigintmat(zmat);
537  return FALSE;
538  }
539  WerrorS("inequalities: unexpected parameters");
540  return TRUE;
541 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
bigintmat * zMatrixToBigintmat(const gfan::ZMatrix &zm)
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int polytopeID
Definition: bbpolytope.cc:17
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
std::pair<gfan::ZMatrix,gfan::ZMatrix> interiorPointsAndNormalsOfFacets ( const gfan::ZCone  zc,
const std::set< gfan::ZVector > &  exceptThesePoints,
const bool  onlyLowerHalfSpace 
)

Definition at line 1674 of file bbcone.cc.

1675 {
1676  gfan::ZMatrix inequalities = zc.getFacets();
1677  gfan::ZMatrix equations = zc.getImpliedEquations();
1678  int r = inequalities.getHeight();
1679  int c = inequalities.getWidth();
1680 
1681  /* our cone has r facets, if r==0 return empty matrices */
1682  gfan::ZMatrix relativeInteriorPoints = gfan::ZMatrix(0,c);
1683  gfan::ZMatrix outerFacetNormals = gfan::ZMatrix(0,c);
1684  if (r==0)
1685  return std::make_pair(relativeInteriorPoints,outerFacetNormals);
1686 
1687  /* next we iterate over each of the r facets,
1688  * build the respective cone and add it to the list
1689  * this is the i=0 case */
1690  gfan::ZMatrix newInequalities = inequalities.submatrix(1,0,r,c);
1691  gfan::ZMatrix newEquations = equations;
1692  newEquations.appendRow(inequalities[0]);
1693  gfan::ZCone facet = gfan::ZCone(newInequalities,newEquations);
1694  gfan::ZVector interiorPoint = facet.getRelativeInteriorPoint();
1695  if (onlyLowerHalfSpace==false || interiorPoint[0].sign()<0)
1696  {
1697  if (exceptThesePoints.count(interiorPoint)==0)
1698  {
1699  relativeInteriorPoints.appendRow(interiorPoint);
1700  outerFacetNormals.appendRow(-inequalities[0]);
1701  }
1702  }
1703 
1704  /* these are the cases i=1,...,r-2 */
1705  for (int i=1; i<r-1; i++)
1706  {
1707  newInequalities = inequalities.submatrix(0,0,i,c);
1708  newInequalities.append(inequalities.submatrix(i+1,0,r,c));
1709  newEquations = equations;
1710  newEquations.appendRow(inequalities[i]);
1711  facet = gfan::ZCone(newInequalities,newEquations);
1712  interiorPoint = facet.getRelativeInteriorPoint();
1713  if (onlyLowerHalfSpace==false || interiorPoint[0].sign()<0)
1714  {
1715  if (exceptThesePoints.count(interiorPoint)==0)
1716  {
1717  relativeInteriorPoints.appendRow(interiorPoint);
1718  outerFacetNormals.appendRow(-inequalities[i]);
1719  }
1720  }
1721  }
1722 
1723  /* this is the i=r-1 case */
1724  newInequalities = inequalities.submatrix(0,0,r-1,c);
1725  newEquations = equations;
1726  newEquations.appendRow(inequalities[r-1]);
1727  facet = gfan::ZCone(newInequalities,newEquations);
1728  interiorPoint = facet.getRelativeInteriorPoint();
1729  if (onlyLowerHalfSpace==false || interiorPoint[0].sign()<0)
1730  {
1731  if (exceptThesePoints.count(interiorPoint)==0)
1732  {
1733  relativeInteriorPoints.appendRow(interiorPoint);
1734  outerFacetNormals.appendRow(-inequalities[r-1]);
1735  }
1736  }
1737 
1738  return std::make_pair(relativeInteriorPoints,outerFacetNormals);
1739 }
Definition: gfan.h:44
BOOLEAN inequalities(leftv res, leftv args)
Definition: bbcone.cc:527
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
BOOLEAN equations(leftv res, leftv args)
Definition: bbcone.cc:543
int sign(const CanonicalForm &a)
gfan::ZMatrix interiorPointsOfFacets ( const gfan::ZCone &  zc,
const std::set< gfan::ZVector > &  exceptThese 
)

Definition at line 1620 of file bbcone.cc.

1621 {
1622  gfan::ZMatrix inequalities = zc.getFacets();
1623  gfan::ZMatrix equations = zc.getImpliedEquations();
1624  int r = inequalities.getHeight();
1625  int c = inequalities.getWidth();
1626 
1627  /* our cone has r facets, if r==0 return empty matrices */
1628  gfan::ZMatrix relativeInteriorPoints = gfan::ZMatrix(0,c);
1629  if (r==0) return relativeInteriorPoints;
1630 
1631  /* next we iterate over each of the r facets,
1632  * build the respective cone and add it to the list
1633  * this is the i=0 case */
1634  gfan::ZMatrix newInequalities = inequalities.submatrix(1,0,r,c);
1635  gfan::ZMatrix newEquations = equations;
1636  newEquations.appendRow(inequalities[0]);
1637  gfan::ZCone facet = gfan::ZCone(newInequalities,newEquations);
1638  facet.canonicalize();
1639  gfan::ZVector interiorPoint = facet.getRelativeInteriorPoint();
1640  if (exceptThese.count(interiorPoint)==0)
1641  relativeInteriorPoints.appendRow(interiorPoint);
1642 
1643  /* these are the cases i=1,...,r-2 */
1644  for (int i=1; i<r-1; i++)
1645  {
1646  newInequalities = inequalities.submatrix(0,0,i,c);
1647  newInequalities.append(inequalities.submatrix(i+1,0,r,c));
1648  newEquations = equations;
1649  newEquations.appendRow(inequalities[i]);
1650  facet = gfan::ZCone(newInequalities,newEquations);
1651  facet.canonicalize();
1652  interiorPoint = facet.getRelativeInteriorPoint();
1653  if (exceptThese.count(interiorPoint)==0)
1654  relativeInteriorPoints.appendRow(interiorPoint);
1655  }
1656 
1657  /* this is the i=r-1 case */
1658  newInequalities = inequalities.submatrix(0,0,r-1,c);
1659  newEquations = equations;
1660  newEquations.appendRow(inequalities[r-1]);
1661  facet = gfan::ZCone(newInequalities,newEquations);
1662  facet.canonicalize();
1663  interiorPoint = facet.getRelativeInteriorPoint();
1664  if (exceptThese.count(interiorPoint)==0)
1665  relativeInteriorPoints.appendRow(interiorPoint);
1666 
1667  return relativeInteriorPoints;
1668 }
Definition: gfan.h:44
BOOLEAN inequalities(leftv res, leftv args)
Definition: bbcone.cc:527
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
BOOLEAN equations(leftv res, leftv args)
Definition: bbcone.cc:543
BOOLEAN intersectCones ( leftv  res,
leftv  args 
)

Definition at line 1081 of file bbcone.cc.

1082 {
1083  leftv u = args;
1084  if ((u != NULL) && (u->Typ() == coneID))
1085  {
1086  leftv v = u->next;
1087  if ((v != NULL) && (v->Typ() == coneID))
1088  {
1089  gfan::ZCone* zc1 = (gfan::ZCone*)u->Data();
1090  gfan::ZCone* zc2 = (gfan::ZCone*)v->Data();
1091  int d1 = zc1->ambientDimension();
1092  int d2 = zc2->ambientDimension();
1093  if (d1 != d2)
1094  {
1095  Werror("expected ambient dims of both cones to coincide\n"
1096  "but got %d and %d", d1, d2);
1097  return TRUE;
1098  }
1099  gfan::ZCone zc3 = gfan::intersection(*zc1, *zc2);
1100  zc3.canonicalize();
1101  res->rtyp = coneID;
1102  res->data = (void *)new gfan::ZCone(zc3);
1103  return FALSE;
1104  }
1105  if ((v != NULL) && (v->Typ() == polytopeID))
1106  {
1107  gfan::ZCone* zc11 = (gfan::ZCone*)u->Data();
1108  gfan::ZCone zc1 = liftUp(*zc11);
1109  gfan::ZCone* zc2 = (gfan::ZCone*)v->Data();
1110  int d1 = zc1.ambientDimension();
1111  int d2 = zc2->ambientDimension();
1112  if (d1 != d2)
1113  {
1114  Werror("expected ambient dims of both cones to coincide\n"
1115  "but got %d and %d", d1, d2);
1116  return TRUE;
1117  }
1118  gfan::ZCone zc3 = gfan::intersection(zc1, *zc2);
1119  zc3.canonicalize();
1120  res->rtyp = polytopeID;
1121  res->data = (void *)new gfan::ZCone(zc3);
1122  return FALSE;
1123  }
1124  }
1125  if ((u != NULL) && (u->Typ() == polytopeID))
1126  {
1127  leftv v = u->next;
1128  if ((v != NULL) && (v->Typ() == coneID))
1129  {
1130  gfan::ZCone* zc1 = (gfan::ZCone*)u->Data();
1131  gfan::ZCone* zc22 = (gfan::ZCone*)v->Data();
1132  gfan::ZCone zc2 = liftUp(*zc22);
1133  int d1 = zc1->ambientDimension();
1134  int d2 = zc2.ambientDimension();
1135  if (d1 != d2)
1136  {
1137  Werror("expected ambient dims of both cones to coincide\n"
1138  "but got %d and %d", d1, d2);
1139  return TRUE;
1140  }
1141  gfan::ZCone zc3 = gfan::intersection(*zc1, zc2);
1142  zc3.canonicalize();
1143  res->rtyp = polytopeID;
1144  res->data = (void *)new gfan::ZCone(zc3);
1145  return FALSE;
1146  }
1147  if ((v != NULL) && (v->Typ() == polytopeID))
1148  {
1149  gfan::ZCone* zc1 = (gfan::ZCone*)u->Data();
1150  gfan::ZCone* zc2 = (gfan::ZCone*)v->Data();
1151  int d1 = zc1->ambientDimension();
1152  int d2 = zc2->ambientDimension();
1153  if (d1 != d2)
1154  {
1155  Werror("expected ambient dims of both cones to coincide\n"
1156  "but got %d and %d", d1, d2);
1157  return TRUE;
1158  }
1159  gfan::ZCone zc3 = gfan::intersection(*zc1, *zc2);
1160  zc3.canonicalize();
1161  res->rtyp = polytopeID;
1162  res->data = (void *)new gfan::ZCone(zc3);
1163  return FALSE;
1164  }
1165  }
1166  WerrorS("convexIntersection: unexpected parameters");
1167  return TRUE;
1168 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
gfan::ZMatrix liftUp(const gfan::ZMatrix &zm)
Definition: bbcone.cc:1044
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int polytopeID
Definition: bbpolytope.cc:17
int coneID
Definition: bbcone.cc:24
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN isFullSpace ( leftv  res,
leftv  args 
)

Definition at line 806 of file bbcone.cc.

807 {
808  leftv u = args;
809  if ((u != NULL) && (u->Typ() == coneID))
810  {
811  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
812  int i = zc->isFullSpace();
813  res->rtyp = INT_CMD;
814  res->data = (void*) (long) i;
815  return FALSE;
816  }
817  WerrorS("isFullSpace: unexpected parameters");
818  return TRUE;
819 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN isOrigin ( leftv  res,
leftv  args 
)

Definition at line 791 of file bbcone.cc.

792 {
793  leftv u = args;
794  if ((u != NULL) && (u->Typ() == coneID))
795  {
796  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
797  int i = zc->isOrigin();
798  res->rtyp = INT_CMD;
799  res->data = (void*) (long) i;
800  return FALSE;
801  }
802  WerrorS("isOrigin: unexpected parameters");
803  return TRUE;
804 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN isSimplicial ( leftv  res,
leftv  args 
)

Definition at line 821 of file bbcone.cc.

822 {
823  leftv u=args;
824  if ((u != NULL) && (u->Typ() == coneID))
825  {
826  gfan::ZCone* zc = (gfan::ZCone*) u->Data();
827  int b = zc->isSimplicial();
828  res->rtyp = INT_CMD;
829  res->data = (void*) (long) b;
830  return FALSE;
831  }
832  if ((u != NULL) && (u->Typ() == fanID))
833  {
834  gfan::ZFan* zf = (gfan::ZFan*) u->Data();
835  bool b = isSimplicial(zf);
836  res->rtyp = INT_CMD;
837  res->data = (void*) (long) b;
838  return FALSE;
839  }
840  WerrorS("isSimplicial: unexpected parameters");
841  return TRUE;
842 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int fanID
Definition: bbfan.cc:18
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
BOOLEAN isSimplicial(leftv res, leftv args)
Definition: bbcone.cc:821
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
const poly b
Definition: syzextra.cc:213
static BOOLEAN jjCONENORMALS1 ( leftv  res,
leftv  v 
)
static

Definition at line 236 of file bbcone.cc.

237 {
238  /* method for generating a cone object from inequalities;
239  valid parametrizations: (intmat) */
240  bigintmat* ineq = NULL;
241  if (v->Typ() == INTMAT_CMD)
242  {
243  intvec* ineq0 = (intvec*) v->Data();
244  ineq = iv2bim(ineq0,coeffs_BIGINT);
245  }
246  else
247  ineq = (bigintmat*) v->Data();
248  gfan::ZMatrix* zm = bigintmatToZMatrix(ineq);
249  gfan::ZCone* zc = new gfan::ZCone(*zm, gfan::ZMatrix(0, zm->getWidth()));
250  delete zm;
251  if (v->Typ() == INTMAT_CMD)
252  delete ineq;
253  res->rtyp = coneID;
254  res->data = (void*) zc;
255  return FALSE;
256 }
#define FALSE
Definition: auxiliary.h:140
Matrices of numbers.
Definition: bigintmat.h:32
bigintmat * iv2bim(intvec *b, const coeffs C)
Definition: bigintmat.cc:349
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
static BOOLEAN jjCONENORMALS2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 258 of file bbcone.cc.

259 {
260  /* method for generating a cone object from iequalities,
261  and equations (...)
262  valid parametrizations: (intmat, intmat)
263  Errors will be invoked in the following cases:
264  - u and v have different numbers of columns */
265  bigintmat* ineq = NULL; bigintmat* eq = NULL;
266  if (u->Typ() == INTMAT_CMD)
267  {
268  intvec* ineq0 = (intvec*) u->Data();
269  ineq = iv2bim(ineq0,coeffs_BIGINT);
270  }
271  else
272  ineq = (bigintmat*) u->Data();
273  if (v->Typ() == INTMAT_CMD)
274  {
275  intvec* eq0 = (intvec*) v->Data();
276  eq = iv2bim(eq0,coeffs_BIGINT);
277  }
278  else
279  eq = (bigintmat*) v->Data();
280 
281  if (ineq->cols() != eq->cols())
282  {
283  Werror("expected same number of columns but got %d vs. %d",
284  ineq->cols(), eq->cols());
285  return TRUE;
286  }
287  gfan::ZMatrix* zm1 = bigintmatToZMatrix(ineq);
288  gfan::ZMatrix* zm2 = bigintmatToZMatrix(eq);
289  gfan::ZCone* zc = new gfan::ZCone(*zm1, *zm2);
290  delete zm1;
291  delete zm2;
292  if (u->Typ() == INTMAT_CMD)
293  delete ineq;
294  if (v->Typ() == INTMAT_CMD)
295  delete eq;
296  res->rtyp = coneID;
297  res->data = (void*) zc;
298  return FALSE;
299 }
#define FALSE
Definition: auxiliary.h:140
Matrices of numbers.
Definition: bigintmat.h:32
bigintmat * iv2bim(intvec *b, const coeffs C)
Definition: bigintmat.cc:349
#define TRUE
Definition: auxiliary.h:144
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
int coneID
Definition: bbcone.cc:24
int cols() const
Definition: bigintmat.h:128
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
void Werror(const char *fmt,...)
Definition: reporter.cc:199
static BOOLEAN jjCONENORMALS3 ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 301 of file bbcone.cc.

302 {
303  /* method for generating a cone object from inequalities, equations,
304  and an integer k;
305  valid parametrizations: (intmat, intmat, int);
306  Errors will be invoked in the following cases:
307  - u and v have different numbers of columns,
308  - k not in [0..3];
309  if the 2^0-bit of k is set, then ... */
310  bigintmat* ineq = NULL; bigintmat* eq = NULL;
311  if (u->Typ() == INTMAT_CMD)
312  {
313  intvec* ineq0 = (intvec*) u->Data();
314  ineq = iv2bim(ineq0,coeffs_BIGINT);
315  }
316  else
317  ineq = (bigintmat*) u->Data();
318  if (v->Typ() == INTMAT_CMD)
319  {
320  intvec* eq0 = (intvec*) v->Data();
321  eq = iv2bim(eq0,coeffs_BIGINT);
322  }
323  else
324  eq = (bigintmat*) v->Data();
325  if (ineq->cols() != eq->cols())
326  {
327  Werror("expected same number of columns but got %d vs. %d",
328  ineq->cols(), eq->cols());
329  return TRUE;
330  }
331  int k = (int)(long)w->Data();
332  if ((k < 0) || (k > 3))
333  {
334  WerrorS("expected int argument in [0..3]");
335  return TRUE;
336  }
337  gfan::ZMatrix* zm1 = bigintmatToZMatrix(ineq);
338  gfan::ZMatrix* zm2 = bigintmatToZMatrix(eq);
339  gfan::ZCone* zc = new gfan::ZCone(*zm1, *zm2, k);
340  delete zm1;
341  delete zm2;
342  if (u->Typ() == INTMAT_CMD)
343  delete ineq;
344  if (v->Typ() == INTMAT_CMD)
345  delete eq;
346  res->rtyp = coneID;
347  res->data = (void*) zc;
348  return FALSE;
349 }
#define FALSE
Definition: auxiliary.h:140
Matrices of numbers.
Definition: bigintmat.h:32
bigintmat * iv2bim(intvec *b, const coeffs C)
Definition: bigintmat.cc:349
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int k
Definition: cfEzgcd.cc:93
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
int coneID
Definition: bbcone.cc:24
int cols() const
Definition: bigintmat.h:128
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
void Werror(const char *fmt,...)
Definition: reporter.cc:199
static BOOLEAN jjCONERAYS1 ( leftv  res,
leftv  v 
)
static

Definition at line 372 of file bbcone.cc.

373 {
374  /* method for generating a cone object from half-lines
375  (cone = convex hull of the half-lines; note: there may be
376  entire lines in the cone);
377  valid parametrizations: (intmat) */
378  bigintmat* rays = NULL;
379  if (v->Typ() == INTMAT_CMD)
380  {
381  intvec* rays0 = (intvec*) v->Data();
382  rays = iv2bim(rays0,coeffs_BIGINT);
383  }
384  else
385  rays = (bigintmat*) v->Data();
386 
387  gfan::ZMatrix* zm = bigintmatToZMatrix(rays);
388  gfan::ZCone* zc = new gfan::ZCone();
389  *zc = gfan::ZCone::givenByRays(*zm, gfan::ZMatrix(0, zm->getWidth()));
390  res->rtyp = coneID;
391  res->data = (void*) zc;
392 
393  delete zm;
394  if (v->Typ() == INTMAT_CMD)
395  delete rays;
396  return FALSE;
397 }
#define FALSE
Definition: auxiliary.h:140
Matrices of numbers.
Definition: bigintmat.h:32
bigintmat * iv2bim(intvec *b, const coeffs C)
Definition: bigintmat.cc:349
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
int coneID
Definition: bbcone.cc:24
BOOLEAN rays(leftv res, leftv args)
Definition: bbcone.cc:618
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
static BOOLEAN jjCONERAYS2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 399 of file bbcone.cc.

400 {
401  /* method for generating a cone object from half-lines,
402  and lines (any point in the cone being the sum of a point
403  in the convex hull of the half-lines and a point in the span
404  of the lines; the second argument may contain or entirely consist
405  of zero rows);
406  valid parametrizations: (intmat, intmat)
407  Errors will be invoked in the following cases:
408  - u and v have different numbers of columns */
409  bigintmat* rays = NULL; bigintmat* linSpace = NULL;
410  if (u->Typ() == INTMAT_CMD)
411  {
412  intvec* rays0 = (intvec*) u->Data();
413  rays = iv2bim(rays0,coeffs_BIGINT);
414  }
415  else
416  rays = (bigintmat*) u->Data();
417  if (v->Typ() == INTMAT_CMD)
418  {
419  intvec* linSpace0 = (intvec*) v->Data();
420  linSpace = iv2bim(linSpace0,coeffs_BIGINT);
421  }
422  else
423  linSpace = (bigintmat*) v->Data();
424 
425  if (rays->cols() != linSpace->cols())
426  {
427  Werror("expected same number of columns but got %d vs. %d",
428  rays->cols(), linSpace->cols());
429  return TRUE;
430  }
431  gfan::ZMatrix* zm1 = bigintmatToZMatrix(rays);
432  gfan::ZMatrix* zm2 = bigintmatToZMatrix(linSpace);
433  gfan::ZCone* zc = new gfan::ZCone();
434  *zc = gfan::ZCone::givenByRays(*zm1, *zm2);
435  res->rtyp = coneID;
436  res->data = (void*) zc;
437 
438  delete zm1;
439  delete zm2;
440  if (u->Typ() == INTMAT_CMD)
441  delete rays;
442  if (v->Typ() == INTMAT_CMD)
443  delete linSpace;
444  return FALSE;
445 }
#define FALSE
Definition: auxiliary.h:140
Matrices of numbers.
Definition: bigintmat.h:32
bigintmat * iv2bim(intvec *b, const coeffs C)
Definition: bigintmat.cc:349
#define TRUE
Definition: auxiliary.h:144
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
int coneID
Definition: bbcone.cc:24
int cols() const
Definition: bigintmat.h:128
BOOLEAN rays(leftv res, leftv args)
Definition: bbcone.cc:618
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
void Werror(const char *fmt,...)
Definition: reporter.cc:199
static BOOLEAN jjCONERAYS3 ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 447 of file bbcone.cc.

448 {
449  /* method for generating a cone object from half-lines,
450  and lines (any point in the cone being the sum of a point
451  in the convex hull of the half-lines and a point in the span
452  of the lines), and an integer k;
453  valid parametrizations: (intmat, intmat, int);
454  Errors will be invoked in the following cases:
455  - u and v have different numbers of columns,
456  - k not in [0..3];
457  if the 2^0-bit of k is set, then the lineality space is known
458  to be the span of the provided lines;
459  if the 2^1-bit of k is set, then the extreme rays are known:
460  each half-line spans a (different) extreme ray */
461  bigintmat* rays = NULL; bigintmat* linSpace = NULL;
462  if (u->Typ() == INTMAT_CMD)
463  {
464  intvec* rays0 = (intvec*) u->Data();
465  rays = iv2bim(rays0,coeffs_BIGINT);
466  }
467  else
468  rays = (bigintmat*) u->Data();
469  if (v->Typ() == INTMAT_CMD)
470  {
471  intvec* linSpace0 = (intvec*) v->Data();
472  linSpace = iv2bim(linSpace0,coeffs_BIGINT);
473  }
474  else
475  linSpace = (bigintmat*) v->Data();
476 
477  if (rays->cols() != linSpace->cols())
478  {
479  Werror("expected same number of columns but got %d vs. %d",
480  rays->cols(), linSpace->cols());
481  return TRUE;
482  }
483  int k = (int)(long)w->Data();
484  if ((k < 0) || (k > 3))
485  {
486  WerrorS("expected int argument in [0..3]");
487  return TRUE;
488  }
489  gfan::ZMatrix* zm1 = bigintmatToZMatrix(rays);
490  gfan::ZMatrix* zm2 = bigintmatToZMatrix(linSpace);
491  gfan::ZCone* zc = new gfan::ZCone();
492  *zc = gfan::ZCone::givenByRays(*zm1, *zm2);
493  //k should be passed on to zc; not available yet
494  res->rtyp = coneID;
495  res->data = (void*) zc;
496 
497  delete zm1;
498  delete zm2;
499  if (u->Typ() == INTMAT_CMD)
500  delete rays;
501  if (v->Typ() == INTMAT_CMD)
502  delete linSpace;
503  return FALSE;
504 }
#define FALSE
Definition: auxiliary.h:140
Matrices of numbers.
Definition: bigintmat.h:32
bigintmat * iv2bim(intvec *b, const coeffs C)
Definition: bigintmat.cc:349
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int k
Definition: cfEzgcd.cc:93
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
int coneID
Definition: bbcone.cc:24
int cols() const
Definition: bigintmat.h:128
BOOLEAN rays(leftv res, leftv args)
Definition: bbcone.cc:618
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
void Werror(const char *fmt,...)
Definition: reporter.cc:199
gfan::ZMatrix liftUp ( const gfan::ZMatrix &  zm)

Definition at line 1044 of file bbcone.cc.

1045 {
1046  int r=zm.getHeight();
1047  int c=zm.getWidth();
1048  gfan::ZMatrix zn(r+1,c+1);
1049  zn[1][1]=1;
1050  for (int i=0; i<r; i++)
1051  for (int j=0; j<c; j++)
1052  zn[i+1][j+1]=zm[i][j];
1053  return zn;
1054 }
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
gfan::ZCone liftUp ( const gfan::ZCone &  zc)

Definition at line 1056 of file bbcone.cc.

1057 {
1058  gfan::ZMatrix ineq=zc.getInequalities();
1059  gfan::ZMatrix eq=zc.getEquations();
1060  gfan::ZCone zd(liftUp(ineq),liftUp(eq));
1061  return zd;
1062 }
gfan::ZMatrix liftUp(const gfan::ZMatrix &zm)
Definition: bbcone.cc:1044
BOOLEAN linealityDimension ( leftv  res,
leftv  args 
)

Definition at line 755 of file bbcone.cc.

756 {
757  leftv u=args;
758  if ((u != NULL) && (u->Typ() == coneID))
759  {
760  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
761  res->rtyp = INT_CMD;
762  res->data = (void*) (long) zc->dimensionOfLinealitySpace();
763  return FALSE;
764  }
765  if ((u != NULL) && (u->Typ() == fanID))
766  {
767  gfan::ZFan* zf = (gfan::ZFan*)u->Data();
768  res->rtyp = INT_CMD;
769  res->data = (void*) (long) getLinealityDimension(zf);
770  return FALSE;
771  }
772  WerrorS("linealityDimension: unexpected parameters");
773  return TRUE;
774 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int fanID
Definition: bbfan.cc:18
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
int getLinealityDimension(gfan::ZFan *zf)
Definition: bbfan.cc:257
BOOLEAN linealitySpace ( leftv  res,
leftv  args 
)

Definition at line 859 of file bbcone.cc.

860 {
861  leftv u = args;
862  if ((u != NULL) && (u->Typ() == coneID))
863  {
864  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
865  gfan::ZCone* zd = new gfan::ZCone(zc->linealitySpace());
866  res->rtyp = coneID;
867  res->data = (void*) zd;
868  return FALSE;
869  }
870  WerrorS("linealitySpace: unexpected parameters");
871  return TRUE;
872 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
lists listOfFacets ( const gfan::ZCone &  zc)

Definition at line 1506 of file bbcone.cc.

1507 {
1508  gfan::ZMatrix inequalities = zc.getFacets();
1509  gfan::ZMatrix equations = zc.getImpliedEquations();
1511  int r = inequalities.getHeight();
1512  int c = inequalities.getWidth();
1513  L->Init(r);
1514 
1515  /* next we iterate over each of the r facets, build the respective cone and add it to the list */
1516  /* this is the i=0 case */
1517  gfan::ZMatrix newInequalities = inequalities.submatrix(1,0,r,c);
1518  gfan::ZMatrix newEquations = equations;
1519  newEquations.appendRow(inequalities[0]);
1520  L->m[0].rtyp = coneID; L->m[0].data=(void*) new gfan::ZCone(newInequalities,newEquations);
1521 
1522  /* these are the cases i=1,...,r-2 */
1523  for (int i=1; i<r-1; i++)
1524  {
1525  newInequalities = inequalities.submatrix(0,0,i-1,c);
1526  newInequalities.append(inequalities.submatrix(i+1,0,r,c));
1527  newEquations = equations;
1528  newEquations.appendRow(inequalities[i]);
1529  L->m[i].rtyp = coneID; L->m[i].data=(void*) new gfan::ZCone(newInequalities,newEquations);
1530  }
1531 
1532  /* this is the i=r-1 case */
1533  newInequalities = inequalities.submatrix(0,0,r-1,c);
1534  newEquations = equations;
1535  newEquations.appendRow(inequalities[r]);
1536  L->m[r-1].rtyp = coneID; L->m[r-1].data=(void*) new gfan::ZCone(newInequalities,newEquations);
1537 
1538  return L;
1539 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:45
Definition: lists.h:22
void * data
Definition: subexpr.h:89
BOOLEAN inequalities(leftv res, leftv args)
Definition: bbcone.cc:527
const ring r
Definition: syzextra.cc:208
int coneID
Definition: bbcone.cc:24
int i
Definition: cfEzgcd.cc:123
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
slists * lists
Definition: mpr_numeric.h:146
BOOLEAN equations(leftv res, leftv args)
Definition: bbcone.cc:543
int rtyp
Definition: subexpr.h:92
omBin slists_bin
Definition: lists.cc:23
BOOLEAN listOfFacets ( leftv  res,
leftv  args 
)

Definition at line 1542 of file bbcone.cc.

1543 {
1544  leftv u=args;
1545  if ((u != NULL) && (u->Typ() == coneID))
1546  {
1547  gfan::ZCone* zc = (gfan::ZCone*) u->Data();
1548  lists L = listOfFacets(*zc);
1549  res->rtyp = LIST_CMD;
1550  res->data = (void*) L;
1551  return FALSE;
1552  }
1553  WerrorS("listOfFacets: unexpected parameters");
1554  return TRUE;
1555 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
lists listOfFacets(const gfan::ZCone &zc)
Definition: bbcone.cc:1506
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
Definition: tok.h:96
BOOLEAN negatedCone ( leftv  res,
leftv  args 
)

Definition at line 889 of file bbcone.cc.

890 {
891  leftv u = args;
892  if ((u != NULL) && (u->Typ() == coneID))
893  {
894  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
895  gfan::ZCone* zd = new gfan::ZCone(zc->negated());
896  res->rtyp = coneID;
897  res->data = (void*) zd;
898  return FALSE;
899  }
900  WerrorS("negatedCone: unexpected parameters");
901  return TRUE;
902 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN quotientLatticeBasis ( leftv  res,
leftv  args 
)

Definition at line 641 of file bbcone.cc.

642 {
643  leftv u = args;
644  if ((u != NULL) && (u->Typ() == coneID))
645  {
646  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
647  gfan::ZMatrix zmat = zc->quotientLatticeBasis();
648  res->rtyp = BIGINTMAT_CMD;
649  res->data = (void*) zMatrixToBigintmat(zmat);
650  return FALSE;
651  }
652  WerrorS("quotientLatticeBasis: unexpected parameters");
653  return TRUE;
654 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
bigintmat * zMatrixToBigintmat(const gfan::ZMatrix &zm)
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
gfan::ZVector randomPoint ( const gfan::ZCone *  zc)

Definition at line 956 of file bbcone.cc.

957 {
958  gfan::ZVector rp = gfan::ZVector(zc->ambientDimension());
959 
960  gfan::ZMatrix rays = zc->extremeRays();
961  for (int i=0; i<rays.getHeight(); i++)
962  {
963  int n = siRand();
964  rp = rp + n * rays[i];
965  }
966 
967  gfan::ZMatrix lins = zc->generatorsOfLinealitySpace();
968  for (int i=0; i<lins.getHeight(); i++)
969  {
970  int n = siRand();
971  rp = rp + n * lins[i];
972  }
973 
974  return rp;
975 }
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
int i
Definition: cfEzgcd.cc:123
BOOLEAN rays(leftv res, leftv args)
Definition: bbcone.cc:618
int siRand()
Definition: sirandom.c:41
BOOLEAN randomPoint ( leftv  res,
leftv  args 
)

Definition at line 977 of file bbcone.cc.

978 {
979  leftv u = args;
980  if ((u != NULL) && (u->Typ() == coneID))
981  {
982  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
983  gfan::ZVector zv = randomPoint(zc);
984  res->rtyp = BIGINTMAT_CMD;
985  res->data = (void*) zVectorToBigintmat(zv);
986  return FALSE;
987  }
988  WerrorS("randomPoint: unexpected parameters");
989  return TRUE;
990 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
int Typ()
Definition: subexpr.cc:955
gfan::ZVector randomPoint(const gfan::ZCone *zc)
Definition: bbcone.cc:956
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN rays ( leftv  res,
leftv  args 
)

Definition at line 618 of file bbcone.cc.

619 {
620  leftv u = args;
621  if ((u != NULL) && (u->Typ() == coneID))
622  {
623  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
624  gfan::ZMatrix zm = zc->extremeRays();
625  res->rtyp = BIGINTMAT_CMD;
626  res->data = (void*)zMatrixToBigintmat(zm);
627  return FALSE;
628  }
629  if ((u != NULL) && (u->Typ() == fanID))
630  {
631  gfan::ZFan* zf = (gfan::ZFan*)u->Data();
632  gfan::ZMatrix zmat = rays(zf);
633  res->rtyp = BIGINTMAT_CMD;
634  res->data = (void*) zMatrixToBigintmat(zmat);
635  return FALSE;
636  }
637  WerrorS("rays: unexpected parameters");
638  return TRUE;
639 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
bigintmat * zMatrixToBigintmat(const gfan::ZMatrix &zm)
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int fanID
Definition: bbfan.cc:18
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
BOOLEAN rays(leftv res, leftv args)
Definition: bbcone.cc:618
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN relativeInteriorPoint ( leftv  res,
leftv  args 
)

Definition at line 926 of file bbcone.cc.

927 {
928  leftv u = args;
929  if ((u != NULL) && (u->Typ() == coneID))
930  {
931  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
932  gfan::ZVector zv = zc->getRelativeInteriorPoint();
933  res->rtyp = BIGINTMAT_CMD;
934  res->data = (void*) zVectorToBigintmat(zv);
935  return FALSE;
936  }
937  WerrorS("relativeInteriorPoint: unexpected parameters");
938  return TRUE;
939 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
BOOLEAN semigroupGenerator ( leftv  res,
leftv  args 
)

Definition at line 904 of file bbcone.cc.

905 {
906  leftv u = args;
907  if ((u != NULL) && (u->Typ() == coneID))
908  {
909  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
910  int d = zc->dimension();
911  int dLS = zc->dimensionOfLinealitySpace();
912  if (d == dLS + 1)
913  {
914  gfan::ZVector zv = zc->semiGroupGeneratorOfRay();
915  res->rtyp = BIGINTMAT_CMD;
916  res->data = (void*) zVectorToBigintmat(zv);
917  return FALSE;
918  }
919  Werror("expected dim of cone one larger than dim of lin space\n"
920  "but got dimensions %d and %d", d, dLS);
921  }
922  WerrorS("semigroupGenerator: unexpected parameters");
923  return TRUE;
924 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN setLinearForms ( leftv  res,
leftv  args 
)

Definition at line 1012 of file bbcone.cc.

1013 {
1014  leftv u = args;
1015  if ((u != NULL) && (u->Typ() == coneID))
1016  {
1017  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
1018  leftv v = u->next;
1019  if ((v != NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTVEC_CMD)))
1020  {
1021  bigintmat* mat=NULL;
1022  if (v->Typ() == INTVEC_CMD)
1023  {
1024  intvec* mat0 = (intvec*) v->Data();
1025  mat = iv2bim(mat0,coeffs_BIGINT)->transpose();
1026  }
1027  else
1028  mat = (bigintmat*) v->Data();
1029  gfan::ZMatrix* zm = bigintmatToZMatrix(mat);
1030  zc->setLinearForms(*zm);
1031  res->rtyp = NONE;
1032  res->data = NULL;
1033 
1034  delete zm;
1035  if (v->Typ() == INTVEC_CMD)
1036  delete mat;
1037  return FALSE;
1038  }
1039  }
1040  WerrorS("setLinearForms: unexpected parameters");
1041  return TRUE;
1042 }
bigintmat * transpose()
Definition: bigintmat.cc:38
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
Matrices of numbers.
Definition: bigintmat.h:32
bigintmat * iv2bim(intvec *b, const coeffs C)
Definition: bigintmat.cc:349
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
int coneID
Definition: bbcone.cc:24
Definition: tok.h:88
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
#define NONE
Definition: tok.h:170
BOOLEAN setMultiplicity ( leftv  res,
leftv  args 
)

Definition at line 992 of file bbcone.cc.

993 {
994  leftv u = args;
995  if ((u != NULL) && (u->Typ() == coneID))
996  {
997  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
998  leftv v = u->next;
999  if ((v != NULL) && (v->Typ() == INT_CMD))
1000  {
1001  int val = (int)(long)v->Data();
1002  zc->setMultiplicity(gfan::Integer(val));
1003  res->rtyp = NONE;
1004  res->data = NULL;
1005  return FALSE;
1006  }
1007  }
1008  WerrorS("setMultiplicity: unexpected parameters");
1009  return TRUE;
1010 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
#define NONE
Definition: tok.h:170
std::string toString ( const gfan::ZCone *const  c)

Definition at line 26 of file bbcone.cc.

27 {
28  std::stringstream s;
29  s<<"AMBIENT_DIM"<<std::endl;
30  s<<c->ambientDimension()<<std::endl;
31 
32  gfan::ZMatrix i=c->getInequalities();
33  char* ineqs = toString(i);
34  if (c->areFacetsKnown())
35  s<<"FACETS"<<std::endl;
36  else
37  s<<"INEQUALITIES"<<std::endl;
38  if (ineqs!=NULL)
39  {
40  s<<ineqs<<std::endl;
41  omFree(ineqs);
42  }
43 
44  gfan::ZMatrix e=c->getEquations();
45  char* eqs = toString(e);
46  if (c->areImpliedEquationsKnown())
47  s<<"LINEAR_SPAN"<<std::endl;
48  else
49  s<<"EQUATIONS"<<std::endl;
50  if (eqs!=NULL)
51  {
52  s<<eqs<<std::endl;
53  omFree(eqs);
54  }
55 
56  if (c->areExtremeRaysKnown())
57  {
58  gfan::ZMatrix r=c->extremeRays();
59  char* rs = toString(r);
60  s<<"RAYS"<<std::endl;
61  if (rs!=NULL)
62  {
63  s<<rs<<std::endl;
64  omFree(rs);
65  }
66  gfan::ZMatrix l=c->generatorsOfLinealitySpace();
67  char* ls = toString(l);
68  s<<"LINEALITY_SPACE"<<std::endl;
69  if (ls!=NULL)
70  {
71  s<<ls<<std::endl;
72  omFree(ls);
73  }
74  }
75 
76  return s.str();
77 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
const ring r
Definition: syzextra.cc:208
#define omFree(addr)
Definition: omAllocDecl.h:261
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
std::string toString(const gfan::ZCone *const c)
Definition: bbcone.cc:26
int l
Definition: cfEzgcd.cc:94
BOOLEAN uniquePoint ( leftv  res,
leftv  args 
)

Definition at line 941 of file bbcone.cc.

942 {
943  leftv u = args;
944  if ((u != NULL) && (u->Typ() == coneID))
945  {
946  gfan::ZCone* zc = (gfan::ZCone*)u->Data();
947  gfan::ZVector zv = zc->getUniquePoint();
948  res->rtyp = BIGINTMAT_CMD;
949  res->data = (void*) zVectorToBigintmat(zv);
950  return FALSE;
951  }
952  WerrorS("uniquePoint: unexpected parameters");
953  return TRUE;
954 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
int coneID
Definition: bbcone.cc:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097

Variable Documentation

int coneID

Definition at line 24 of file bbcone.cc.