14 #include <gfanlib/gfanlib.h> 15 #include <gfanlib/gfanlib_q.h> 22 gfan::ZMatrix
i=c.getInequalities();
23 gfan::ZMatrix e=c.getEquations();
24 s<<
"AMBIENT_DIM"<<std::endl;
25 s<<c.ambientDimension()-1<<std::endl;
26 s<<
"INEQUALITIES"<<std::endl;
28 s<<
"EQUATIONS"<<std::endl;
35 return (
void*)(
new gfan::ZCone());
45 gfan::ZCone* zd = (gfan::ZCone*)l->
Data();
48 newZc =
new gfan::ZCone();
50 else if (r->
Typ()==l->
Typ())
54 gfan::ZCone* zd = (gfan::ZCone*)l->
Data();
57 gfan::ZCone* zc = (gfan::ZCone*)r->
Data();
58 newZc =
new gfan::ZCone(*zc);
77 Werror(
"assign Type(%d) = Type(%d) not implemented",l->
Typ(),r->
Typ());
87 l->
data=(
void *)newZc;
96 gfan::ZCone* zc = (gfan::ZCone*)d;
106 gfan::ZCone* zc = (gfan::ZCone*) d;
113 gfan::ZCone* zc = (gfan::ZCone*)d;
114 gfan::ZCone* newZc =
new gfan::ZCone(*zc);
134 gfan::ZCone* zc =
new gfan::ZCone();
135 *zc = gfan::ZCone::givenByRays(*zm, gfan::ZMatrix(0, zm->getWidth()));
137 res->
data = (
void*) zc;
164 int k = (int)(
long)v->
Data();
166 if ((k < 0) || (k > 1))
168 WerrorS(
"expected int argument in [0..1]");
173 gfan::ZCone* zc =
new gfan::ZCone();
174 *zc = gfan::ZCone::givenByRays(*zm,gfan::ZMatrix(0, zm->getWidth()));
177 res->
data = (
void*) zc;
197 WerrorS(
"polytopeViaPoints: unexpected parameters");
214 gfan::ZCone* zc =
new gfan::ZCone(*zm, gfan::ZMatrix(0, zm->getWidth()));
219 res->
data = (
void*) zc;
248 Werror(
"expected same number of columns but got %d vs. %d",
254 gfan::ZCone* zc =
new gfan::ZCone(*zm1, *zm2);
263 res->
data = (
void*) zc;
294 Werror(
"expected same number of columns but got %d vs. %d",
298 int k = (int)(
long)w->
Data();
299 if ((k < 0) || (k > 3))
301 WerrorS(
"expected int argument in [0..3]");
306 gfan::ZCone* zc =
new gfan::ZCone(*zm1, *zm2, k);
315 res->
data = (
void*) zc;
336 WerrorS(
"polytopeViaInequalities: unexpected parameters");
345 gfan::ZCone* zc = (gfan::ZCone*)u->
Data();
346 gfan::ZMatrix zmat = zc->extremeRays();
351 WerrorS(
"vertices: unexpected parameters");
357 return zc->ambientDimension()-1;
362 return zc->codimension();
367 return zc->dimension()-1;
372 gfan::ZVector zv(d+1);
374 for(
int j=1;
j<=d;
j++)
388 gfan::ZMatrix zm(1,N+1);
389 int *leadexpv = (
int*)
omAlloc((N+1)*
sizeof(int));
398 gfan::ZCone* zc =
new gfan::ZCone();
399 *zc = gfan::ZCone::givenByRays(zm, gfan::ZMatrix(0, zm.getWidth()));
401 res->
data = (
void*) zc;
404 WerrorS(
"newtonPolytope: unexpected parameters");
416 int s = (int)(
long) u->
Data();
417 gfan::ZCone* zp = (gfan::ZCone*) v->
Data();
418 gfan::ZMatrix zm = zp->extremeRays();
419 for (
int i=0;
i<zm.getHeight();
i++)
420 for (
int j=1;
j<zm.getWidth();
j++)
422 gfan::ZCone* zq =
new gfan::ZCone();
423 *zq = gfan::ZCone::givenByRays(zm,gfan::ZMatrix(0, zm.getWidth()));
425 res->
data = (
void*) zq;
429 WerrorS(
"scalePolytope: unexpected parameters");
438 gfan::ZCone* zp = (gfan::ZCone*) u->
Data();
439 gfan::ZCone* zq =
new gfan::ZCone(zp->dualCone());
441 res->
data = (
void*) zq;
444 WerrorS(
"dualPolytope: unexpected parameters");
450 blackbox *
b=(blackbox*)
omAlloc0(
sizeof(blackbox));
const CanonicalForm int s
Class used for (list of) interpreter objects.
BOOLEAN dualPolytope(leftv res, leftv args)
BOOLEAN bbpolytope_Assign(leftv l, leftv r)
BOOLEAN scalePolytope(leftv res, leftv args)
void * bbpolytope_Init(blackbox *)
bigintmat * iv2bim(intvec *b, const coeffs C)
bigintmat * zMatrixToBigintmat(const gfan::ZMatrix &zm)
#define omFreeSize(addr, size)
static BOOLEAN ppCONENORMALS3(leftv res, leftv u, leftv v, leftv w)
static short rVar(const ring r)
#define rVar(r) (r->N)
static BOOLEAN ppCONERAYS1(leftv res, leftv v)
void WerrorS(const char *s)
gfan::ZVector intStar2ZVectorWithLeadingOne(const int d, const int *i)
int getDimension(gfan::ZCone *zc)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
static BOOLEAN ppCONENORMALS2(leftv res, leftv u, leftv v)
const CanonicalForm CFMap CFMap & N
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
void bbpolytope_destroy(blackbox *, void *d)
BOOLEAN vertices(leftv res, leftv args)
BOOLEAN polytopeViaNormals(leftv res, leftv args)
std::string bbpolytopeToString(gfan::ZCone const &c)
const Variable & v
< [in] a sqrfree bivariate poly
BOOLEAN polytopeViaVertices(leftv res, leftv args)
BOOLEAN rays(leftv res, leftv args)
int getCodimension(gfan::ZCone *zc)
int getAmbientDimension(gfan::ZCone *zc)
#define pGetExpV(p, e)
Gets a copy of (resp. set) the exponent vector, where e is assumed to point to (r->N +1)*sizeof(long)...
static BOOLEAN ppCONENORMALS1(leftv res, leftv v)
std::string toString(const gfan::ZCone *const c)
BOOLEAN newtonPolytope(leftv res, leftv args)
char * bbpolytope_String(blackbox *, void *d)
int(* iiAddCproc)(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
int setBlackboxStuff(blackbox *bb, const char *n)
define a new type
static BOOLEAN ppCONERAYS3(leftv res, leftv u, leftv v)
void * bbpolytope_Copy(blackbox *, void *d)
void Werror(const char *fmt,...)
void bbpolytope_setup(SModulFunctions *p)