#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 550 of file bbpolytope.cc.
552 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 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 473 of file bbpolytope.cc.
478 gfan::initializeCddlibIfRequired();
479 gfan::ZCone* zp = (gfan::ZCone*) u->
Data();
480 gfan::ZCone* zq =
new gfan::ZCone(zp->dualCone());
482 res->data = (
void*) zq;
483 gfan::deinitializeCddlibIfRequired();
486 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 387 of file bbpolytope.cc.
389 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 402 of file bbpolytope.cc.
404 gfan::ZVector zv(d+1);
406 for(
int j=1;
j<=d;
j++)
◆ mixedVolume()
Definition at line 490 of file bbpolytope.cc.
495 gfan::initializeCddlibIfRequired();
498 std::vector<gfan::IntMatrix>
P(
k);
499 for (
int i=0;
i<
k;
i++)
503 gfan::ZCone*
p = (gfan::ZCone*)
l->m[
i].Data();
504 gfan::ZMatrix pv =
p->extremeRays();
505 int r = pv.getHeight();
506 int c = pv.getWidth();
507 gfan::IntMatrix pw(
r,c-1);
508 for (
int n=0; n<
r; n++)
509 for (
int m=1;
m<c;
m++)
510 pw[n][
m-1] = pv[n][
m].toInt();
511 P[
i]=pw.transposed();
516 gfan::IntMatrix pw(0,
N);
517 int *leadexpv = (
int*)
omAlloc((
N+1)*
sizeof(int));
521 gfan::IntVector zv(
N);
522 for (
int i=0;
i<
N;
i++)
523 zv[
i] = leadexpv[
i+1];
527 P[
i]=pw.transposed();
532 WerrorS(
"mixedVolume: entries of unsupported type in list");
533 gfan::deinitializeCddlibIfRequired();
541 gfan::deinitializeCddlibIfRequired();
544 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 413 of file bbpolytope.cc.
416 gfan::ZMatrix zm(0,
N+1);
417 int *leadexpv = (
int*)
omAlloc((
N+1)*
sizeof(int));
426 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 430 of file bbpolytope.cc.
435 gfan::initializeCddlibIfRequired();
439 gfan::deinitializeCddlibIfRequired();
442 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 331 of file bbpolytope.cc.
338 gfan::initializeCddlibIfRequired();
340 gfan::deinitializeCddlibIfRequired();
349 gfan::initializeCddlibIfRequired();
351 gfan::deinitializeCddlibIfRequired();
360 gfan::initializeCddlibIfRequired();
362 gfan::deinitializeCddlibIfRequired();
366 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.
192 gfan::initializeCddlibIfRequired();
194 gfan::deinitializeCddlibIfRequired();
202 gfan::initializeCddlibIfRequired();
204 gfan::deinitializeCddlibIfRequired();
209 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 213 of file bbpolytope.cc.
226 gfan::ZCone* zc =
new gfan::ZCone(*zm, gfan::ZMatrix(0, zm->getWidth()));
231 res->data = (
void*) zc;
bigintmat * iv2bim(intvec *b, const coeffs C)
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
const Variable & v
< [in] a sqrfree bivariate poly
◆ ppCONENORMALS2()
Definition at line 235 of file bbpolytope.cc.
260 Werror(
"expected same number of columns but got %d vs. %d",
266 gfan::ZCone* zc =
new gfan::ZCone(*zm1, *zm2);
275 res->data = (
void*) zc;
bigintmat * iv2bim(intvec *b, const coeffs C)
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
const Variable & v
< [in] a sqrfree bivariate poly
void Werror(const char *fmt,...)
◆ ppCONENORMALS3()
Definition at line 279 of file bbpolytope.cc.
306 Werror(
"expected same number of columns but got %d vs. %d",
310 int k = (int)(
long)
w->Data();
311 if ((
k < 0) || (
k > 3))
313 WerrorS(
"expected int argument in [0..3]");
318 gfan::ZCone* zc =
new gfan::ZCone(*zm1, *zm2,
k);
327 res->data = (
void*) zc;
bigintmat * iv2bim(intvec *b, const coeffs C)
void WerrorS(const char *s)
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
const Variable & v
< [in] a sqrfree bivariate poly
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)
const Variable & v
< [in] a sqrfree bivariate poly
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)
const Variable & v
< [in] a sqrfree bivariate poly
BOOLEAN rays(leftv res, leftv args)
◆ scalePolytope()
Definition at line 446 of file bbpolytope.cc.
454 gfan::initializeCddlibIfRequired();
455 int s = (int)(
long) u->
Data();
456 gfan::ZCone* zp = (gfan::ZCone*)
v->Data();
457 gfan::ZMatrix zm = zp->extremeRays();
458 for (
int i=0;
i<zm.getHeight();
i++)
459 for (
int j=1;
j<zm.getWidth();
j++)
461 gfan::ZCone* zq =
new gfan::ZCone();
462 *zq = gfan::ZCone::givenByRays(zm,gfan::ZMatrix(0, zm.getWidth()));
464 res->data = (
void*) zq;
465 gfan::deinitializeCddlibIfRequired();
469 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 370 of file bbpolytope.cc.
375 gfan::initializeCddlibIfRequired();
376 gfan::ZCone* zc = (gfan::ZCone*)u->
Data();
377 gfan::ZMatrix zmat = zc->extremeRays();
380 gfan::deinitializeCddlibIfRequired();
383 WerrorS(
"vertices: unexpected parameters");
Class used for (list of) interpreter objects.
bigintmat * zMatrixToBigintmat(const gfan::ZMatrix &zm)
void WerrorS(const char *s)
◆ polytopeID