#include <kernel/mod2.h>
#include <Singular/ipid.h>
#include <Singular/ipshell.h>
#include <Singular/blackbox.h>
#include <misc/intvec.h>
#include <coeffs/bigintmat.h>
#include <callgfanlib_conversion.h>
#include <sstream>
#include <gfanlib/gfanlib.h>
#include <gfanlib/gfanlib_q.h>
Go to the source code of this file.
|
std::string | bbpolytopeToString (gfan::ZCone const &c) |
|
void * | bbpolytope_Init (blackbox *) |
|
BOOLEAN | bbpolytope_Assign (leftv l, leftv r) |
|
char * | bbpolytope_String (blackbox *, void *d) |
|
void | bbpolytope_destroy (blackbox *, void *d) |
|
void * | bbpolytope_Copy (blackbox *, void *d) |
|
static BOOLEAN | ppCONERAYS1 (leftv res, leftv v) |
|
static BOOLEAN | ppCONERAYS3 (leftv res, leftv u, leftv v) |
|
BOOLEAN | polytopeViaVertices (leftv res, leftv args) |
|
static BOOLEAN | ppCONENORMALS1 (leftv res, leftv v) |
|
static BOOLEAN | ppCONENORMALS2 (leftv res, leftv u, leftv v) |
|
static BOOLEAN | ppCONENORMALS3 (leftv res, leftv u, leftv v, leftv w) |
|
BOOLEAN | polytopeViaNormals (leftv res, leftv args) |
|
BOOLEAN | vertices (leftv res, leftv args) |
|
int | getAmbientDimension (gfan::ZCone *zc) |
|
int | getCodimension (gfan::ZCone *zc) |
|
int | getDimension (gfan::ZCone *zc) |
|
gfan::ZVector | intStar2ZVectorWithLeadingOne (const int d, const int *i) |
|
gfan::ZCone | newtonPolytope (poly p, ring r) |
|
BOOLEAN | newtonPolytope (leftv res, leftv args) |
|
BOOLEAN | scalePolytope (leftv res, leftv args) |
|
BOOLEAN | dualPolytope (leftv res, leftv args) |
|
BOOLEAN | mixedVolume (leftv res, leftv args) |
|
void | bbpolytope_setup (SModulFunctions *p) |
|
§ bbpolytope_Assign()
Definition at line 38 of file bbpolytope.cc.
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;
void Werror(const char *fmt,...)
§ bbpolytope_Copy()
void* bbpolytope_Copy |
( |
blackbox * |
, |
|
|
void * |
d |
|
) |
| |
Definition at line 111 of file bbpolytope.cc.
113 gfan::ZCone* zc = (gfan::ZCone*)d;
114 gfan::ZCone* newZc =
new gfan::ZCone(*zc);
§ bbpolytope_destroy()
void bbpolytope_destroy |
( |
blackbox * |
, |
|
|
void * |
d |
|
) |
| |
Definition at line 102 of file bbpolytope.cc.
106 gfan::ZCone* zc = (gfan::ZCone*) d;
§ bbpolytope_Init()
void* bbpolytope_Init |
( |
blackbox * |
| ) |
|
Definition at line 33 of file bbpolytope.cc.
35 return (
void*)(
new gfan::ZCone());
§ bbpolytope_setup()
Definition at line 516 of file bbpolytope.cc.
518 blackbox *
b=(blackbox*)
omAlloc0(
sizeof(blackbox));
BOOLEAN mixedVolume(leftv res, leftv args)
BOOLEAN dualPolytope(leftv res, leftv args)
BOOLEAN bbpolytope_Assign(leftv l, leftv r)
BOOLEAN scalePolytope(leftv res, leftv args)
void * bbpolytope_Init(blackbox *)
void bbpolytope_destroy(blackbox *, void *d)
BOOLEAN vertices(leftv res, leftv args)
BOOLEAN polytopeViaNormals(leftv res, leftv args)
BOOLEAN polytopeViaVertices(leftv res, leftv args)
gfan::ZCone newtonPolytope(poly p, ring r)
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
void * bbpolytope_Copy(blackbox *, void *d)
§ bbpolytope_String()
char* bbpolytope_String |
( |
blackbox * |
, |
|
|
void * |
d |
|
) |
| |
Definition at line 92 of file bbpolytope.cc.
96 gfan::ZCone* zc = (gfan::ZCone*)d;
const CanonicalForm int s
std::string bbpolytopeToString(gfan::ZCone const &c)
§ bbpolytopeToString()
Definition at line 19 of file bbpolytope.cc.
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;
const CanonicalForm int s
std::string toString(const gfan::ZCone *const c)
§ dualPolytope()
Definition at line 442 of file bbpolytope.cc.
444 gfan::initializeCddlibIfRequired();
448 gfan::ZCone* zp = (gfan::ZCone*) u->
Data();
449 gfan::ZCone* zq =
new gfan::ZCone(zp->dualCone());
451 res->
data = (
void*) zq;
454 WerrorS(
"dualPolytope: unexpected parameters");
Class used for (list of) interpreter objects.
void WerrorS(const char *s)
§ getAmbientDimension()
int getAmbientDimension |
( |
gfan::ZCone * |
zc | ) |
|
Definition at line 358 of file bbpolytope.cc.
360 return zc->ambientDimension()-1;
§ getCodimension()
int getCodimension |
( |
gfan::ZCone * |
zc | ) |
|
§ getDimension()
int getDimension |
( |
gfan::ZCone * |
zc | ) |
|
§ intStar2ZVectorWithLeadingOne()
gfan::ZVector intStar2ZVectorWithLeadingOne |
( |
const int |
d, |
|
|
const int * |
i |
|
) |
| |
Definition at line 373 of file bbpolytope.cc.
375 gfan::ZVector zv(d+1);
377 for(
int j=1;
j<=d;
j++)
§ mixedVolume()
Definition at line 458 of file bbpolytope.cc.
460 gfan::initializeCddlibIfRequired();
466 std::vector<gfan::IntMatrix>
P(k);
467 for (
int i=0;
i<
k;
i++)
471 gfan::ZCone*
p = (gfan::ZCone*) l->
m[
i].
Data();
472 gfan::ZMatrix pv = p->extremeRays();
473 int r = pv.getHeight();
474 int c = pv.getWidth();
475 gfan::IntMatrix pw(r,c-1);
476 for (
int n=0; n<
r; n++)
477 for (
int m=1;
m<c;
m++)
478 pw[n][
m-1] = pv[n][
m].toInt();
479 P[
i]=pw.transposed();
484 gfan::IntMatrix pw(0,N);
485 int *leadexpv = (
int*)
omAlloc((N+1)*
sizeof(int));
489 gfan::IntVector zv(N);
490 for (
int i=0;
i<
N;
i++)
491 zv[
i] = leadexpv[
i+1];
495 P[
i]=pw.transposed();
500 WerrorS(
"mixedVolume: entries of unsupported type in list");
510 WerrorS(
"mixedVolume: unexpected parameters");
BOOLEAN mixedVolume(leftv res, leftv args)
Class used for (list of) interpreter objects.
static void p_GetExpV(poly p, int *ev, const ring r)
#define omFreeSize(addr, size)
static short rVar(const ring r)
#define rVar(r) (r->N)
void WerrorS(const char *s)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
const CanonicalForm CFMap CFMap & N
number integerToNumber(const gfan::Integer &I)
§ newtonPolytope() [1/2]
gfan::ZCone newtonPolytope |
( |
poly |
p, |
|
|
ring |
r |
|
) |
| |
Definition at line 384 of file bbpolytope.cc.
387 gfan::ZMatrix zm(0,N+1);
388 int *leadexpv = (
int*)
omAlloc((N+1)*
sizeof(int));
397 gfan::ZCone Delta = gfan::ZCone::givenByRays(zm,gfan::ZMatrix(0, zm.getWidth()));
static void p_GetExpV(poly p, int *ev, const ring r)
#define omFreeSize(addr, size)
static short rVar(const ring r)
#define rVar(r) (r->N)
gfan::ZVector intStar2ZVectorWithLeadingOne(const int d, const int *i)
const CanonicalForm CFMap CFMap & N
§ newtonPolytope() [2/2]
Definition at line 401 of file bbpolytope.cc.
403 gfan::initializeCddlibIfRequired();
412 WerrorS(
"newtonPolytope: unexpected parameters");
Class used for (list of) interpreter objects.
void WerrorS(const char *s)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
gfan::ZCone newtonPolytope(poly p, ring r)
§ polytopeViaNormals()
Definition at line 320 of file bbpolytope.cc.
322 gfan::initializeCddlibIfRequired();
338 WerrorS(
"polytopeViaInequalities: unexpected parameters");
Class used for (list of) interpreter objects.
static BOOLEAN ppCONENORMALS3(leftv res, leftv u, leftv v, leftv w)
void WerrorS(const char *s)
static BOOLEAN ppCONENORMALS2(leftv res, leftv u, leftv v)
const Variable & v
< [in] a sqrfree bivariate poly
static BOOLEAN ppCONENORMALS1(leftv res, leftv v)
§ polytopeViaVertices()
Definition at line 185 of file bbpolytope.cc.
187 gfan::initializeCddlibIfRequired();
198 WerrorS(
"polytopeViaPoints: unexpected parameters");
Class used for (list of) interpreter objects.
static BOOLEAN ppCONERAYS1(leftv res, leftv v)
void WerrorS(const char *s)
const Variable & v
< [in] a sqrfree bivariate poly
static BOOLEAN ppCONERAYS3(leftv res, leftv u, leftv v)
§ ppCONENORMALS1()
Definition at line 202 of file bbpolytope.cc.
215 gfan::ZCone* zc =
new gfan::ZCone(*zm, gfan::ZMatrix(0, zm->getWidth()));
220 res->
data = (
void*) zc;
bigintmat * iv2bim(intvec *b, const coeffs C)
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
§ ppCONENORMALS2()
Definition at line 224 of file bbpolytope.cc.
249 Werror(
"expected same number of columns but got %d vs. %d",
255 gfan::ZCone* zc =
new gfan::ZCone(*zm1, *zm2);
264 res->
data = (
void*) zc;
bigintmat * iv2bim(intvec *b, const coeffs C)
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
void Werror(const char *fmt,...)
§ ppCONENORMALS3()
Definition at line 268 of file bbpolytope.cc.
295 Werror(
"expected same number of columns but got %d vs. %d",
299 int k = (int)(
long)w->
Data();
300 if ((k < 0) || (k > 3))
302 WerrorS(
"expected int argument in [0..3]");
307 gfan::ZCone* zc =
new gfan::ZCone(*zm1, *zm2, k);
316 res->
data = (
void*) zc;
bigintmat * iv2bim(intvec *b, const coeffs C)
void WerrorS(const char *s)
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
void Werror(const char *fmt,...)
§ ppCONERAYS1()
Definition at line 118 of file bbpolytope.cc.
134 gfan::ZCone* zc =
new gfan::ZCone();
135 *zc = gfan::ZCone::givenByRays(*zm, gfan::ZMatrix(0, zm->getWidth()));
137 res->
data = (
void*) zc;
bigintmat * iv2bim(intvec *b, const coeffs C)
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
BOOLEAN rays(leftv res, leftv args)
§ ppCONERAYS3()
Definition at line 145 of file bbpolytope.cc.
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;
bigintmat * iv2bim(intvec *b, const coeffs C)
void WerrorS(const char *s)
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
BOOLEAN rays(leftv res, leftv args)
§ scalePolytope()
Definition at line 416 of file bbpolytope.cc.
418 gfan::initializeCddlibIfRequired();
425 int s = (int)(
long) u->
Data();
426 gfan::ZCone* zp = (gfan::ZCone*) v->
Data();
427 gfan::ZMatrix zm = zp->extremeRays();
428 for (
int i=0;
i<zm.getHeight();
i++)
429 for (
int j=1;
j<zm.getWidth();
j++)
431 gfan::ZCone* zq =
new gfan::ZCone();
432 *zq = gfan::ZCone::givenByRays(zm,gfan::ZMatrix(0, zm.getWidth()));
434 res->
data = (
void*) zq;
438 WerrorS(
"scalePolytope: unexpected parameters");
const CanonicalForm int s
Class used for (list of) interpreter objects.
void WerrorS(const char *s)
const Variable & v
< [in] a sqrfree bivariate poly
§ vertices()
Definition at line 342 of file bbpolytope.cc.
344 gfan::initializeCddlibIfRequired();
348 gfan::ZCone* zc = (gfan::ZCone*)u->
Data();
349 gfan::ZMatrix zmat = zc->extremeRays();
354 WerrorS(
"vertices: unexpected parameters");
Class used for (list of) interpreter objects.
bigintmat * zMatrixToBigintmat(const gfan::ZMatrix &zm)
void WerrorS(const char *s)
§ polytopeID