My Project
Loading...
Searching...
No Matches
Functions | Variables
bbfan.h File Reference
#include "kernel/mod2.h"
#include "Singular/ipid.h"
#include "gfanlib/gfanlib.h"

Go to the source code of this file.

Functions

void bbfan_setup (SModulFunctions *p)
 
bool isCompatible (const gfan::ZFan *zf, const gfan::ZCone *zc)
 
int getAmbientDimension (gfan::ZFan *zf)
 
int getCodimension (gfan::ZFan *zf)
 
int getDimension (gfan::ZFan *zf)
 
int getLinealityDimension (gfan::ZFan *zf)
 
int isSimplicial (gfan::ZFan *zf)
 
gfan::Matrix< gfan::Integer > rays (const gfan::ZFan *const zf)
 
gfan::ZFan commonRefinement (gfan::ZFan zf, gfan::ZFan zg)
 

Variables

EXTERN_VAR int fanID
 

Function Documentation

◆ bbfan_setup()

void bbfan_setup ( SModulFunctions p)

Definition at line 1082 of file bbfan.cc.

1083{
1084 blackbox *b=(blackbox*)omAlloc0(sizeof(blackbox));
1085 // all undefined entries will be set to default in setBlackboxStuff
1086 // the default Print is quite usefule,
1087 // all other are simply error messages
1088 b->blackbox_destroy=bbfan_destroy;
1089 b->blackbox_String=bbfan_String;
1090 //b->blackbox_Print=blackbox_default_Print;
1091 b->blackbox_Init=bbfan_Init;
1092 b->blackbox_Copy=bbfan_Copy;
1093 b->blackbox_Assign=bbfan_Assign;
1094 b->blackbox_serialize=bbfan_serialize;
1095 b->blackbox_deserialize=bbfan_deserialize;
1096 p->iiAddCproc("gfan.lib","emptyFan",FALSE,emptyFan);
1097 p->iiAddCproc("gfan.lib","fullFan",FALSE,fullFan);
1098 /* the following functions are implemented in bbcone.cc */
1099 // iiAddCproc("gfan.lib","containsInSupport",FALSE,containsInSupport);
1100 // iiAddCproc("gfan.lib","getAmbientDimension",FALSE,getAmbientDimension);
1101 // iiAddCproc("gfan.lib","getCodimension",FALSE,getDimension);
1102 // iiAddCproc("gfan.lib","getDimension",FALSE,getDimension);
1103 // iiAddCproc("gfan.lib","getLinealityDimension",FALSE,getLinealityDimension);
1104 // iiAddCproc("gfan.lib","isSimplicial",FALSE,isSimplicial);
1105 /********************************************************/
1106 p->iiAddCproc("gfan.lib","isCompatible",FALSE,isCompatible);
1107 p->iiAddCproc("gfan.lib","numberOfConesOfDimension",FALSE,numberOfConesOfDimension);
1108 p->iiAddCproc("gfan.lib","ncones",FALSE,ncones);
1109 p->iiAddCproc("gfan.lib","nmaxcones",FALSE,nmaxcones);
1110 p->iiAddCproc("gfan.lib","insertCone",FALSE,insertCone);
1111 p->iiAddCproc("gfan.lib","removeCone",FALSE,removeCone);
1112 p->iiAddCproc("gfan.lib","getCone",FALSE,getCone);
1113 p->iiAddCproc("gfan.lib","getCones",FALSE,getCones);
1114 p->iiAddCproc("gfan.lib","isPure",FALSE,isPure);
1115 p->iiAddCproc("gfan.lib","fanFromString",FALSE,fanFromString);
1116 p->iiAddCproc("gfan.lib","fanViaCones",FALSE,fanViaCones);
1117 p->iiAddCproc("gfan.lib","numberOfConesWithVector",FALSE,numberOfConesWithVector);
1118 // iiAddCproc("gfan.lib","isComplete",FALSE,isComplete); not working as expected, should leave this to polymake
1119 p->iiAddCproc("gfan.lib","fVector",FALSE,fVector);
1120 p->iiAddCproc("gfan.lib","containsInCollection",FALSE,containsInCollection);
1121 // p->iiAddCproc("gfan.lib","tropicalVariety",FALSE,tropicalVariety);
1122 p->iiAddCproc("gfan.lib","commonRefinement",FALSE,commonRefinement);
1123 // iiAddCproc("gfan.lib","grFan",FALSE,grFan);
1124 fanID=setBlackboxStuff(b,"fan");
1125 //Print("created type %d (fan)\n",fanID);
1126}
#define FALSE
Definition: auxiliary.h:96
BOOLEAN nmaxcones(leftv res, leftv args)
Definition: bbfan.cc:331
BOOLEAN numberOfConesOfDimension(leftv res, leftv args)
Definition: bbfan.cc:266
BOOLEAN emptyFan(leftv res, leftv args)
Definition: bbfan.cc:176
BOOLEAN fanViaCones(leftv res, leftv args)
Definition: bbfan.cc:814
bool containsInCollection(gfan::ZFan *zf, gfan::ZCone *zc)
Definition: bbfan.cc:433
BOOLEAN fullFan(leftv res, leftv args)
Definition: bbfan.cc:228
BOOLEAN getCones(leftv res, leftv args)
Definition: bbfan.cc:609
char * bbfan_String(blackbox *, void *d)
Definition: bbfan.cc:35
BOOLEAN fanFromString(leftv res, leftv args)
Definition: bbfan.cc:796
BOOLEAN isPure(leftv res, leftv args)
Definition: bbfan.cc:688
void * bbfan_Copy(blackbox *, void *d)
Definition: bbfan.cc:64
int numberOfConesWithVector(gfan::ZFan *zf, gfan::ZVector *v)
Definition: bbfan.cc:748
BOOLEAN ncones(leftv res, leftv args)
Definition: bbfan.cc:309
BOOLEAN bbfan_deserialize(blackbox **b, void **d, si_link f)
Definition: bbfan.cc:1063
BOOLEAN removeCone(leftv res, leftv args)
Definition: bbfan.cc:514
void bbfan_destroy(blackbox *, void *d)
Definition: bbfan.cc:26
VAR int fanID
Definition: bbfan.cc:19
gfan::ZFan commonRefinement(gfan::ZFan zf, gfan::ZFan zg)
Definition: bbfan.cc:948
void * bbfan_Init(blackbox *)
Definition: bbfan.cc:21
BOOLEAN getCone(leftv res, leftv args)
Definition: bbfan.cc:553
BOOLEAN bbfan_Assign(leftv l, leftv r)
Definition: bbfan.cc:71
BOOLEAN bbfan_serialize(blackbox *b, void *d, si_link f)
Definition: bbfan.cc:1044
bool isCompatible(const gfan::ZFan *zf, const gfan::ZCone *zc)
Definition: bbfan.cc:352
BOOLEAN insertCone(leftv res, leftv args)
Definition: bbfan.cc:393
BOOLEAN fVector(leftv res, leftv args)
Definition: bbfan.cc:720
int setBlackboxStuff(blackbox *bb, const char *n)
define a new type
Definition: blackbox.cc:142
int p
Definition: cfModGcd.cc:4078
CanonicalForm b
Definition: cfModGcd.cc:4103
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ commonRefinement()

gfan::ZFan commonRefinement ( gfan::ZFan  zf,
gfan::ZFan  zg 
)

Definition at line 948 of file bbfan.cc.

949{
950 assume(zf.getAmbientDimension() == zg.getAmbientDimension());
951
952 // gather all maximal cones of f and g
953 std::list<gfan::ZCone> maximalConesOfF;
954 for (int d=0; d<=zf.getAmbientDimension(); d++)
955 for (int i=0; i<zf.numberOfConesOfDimension(d,0,1); i++)
956 maximalConesOfF.push_back(zf.getCone(d,i,0,1));
957
958 std::list<gfan::ZCone> maximalConesOfG;
959 for (int d=0; d<=zg.getAmbientDimension(); d++)
960 for (int i=0; i<zg.numberOfConesOfDimension(d,0,1); i++)
961 maximalConesOfG.push_back(zg.getCone(d,i,0,1));
962
963 // construct a new fan out of their intersections
964 gfan::ZFan zr = gfan::ZFan(zf.getAmbientDimension());
965 for (std::list<gfan::ZCone>::iterator itf=maximalConesOfF.begin();
966 itf != maximalConesOfF.end(); itf++)
967 for (std::list<gfan::ZCone>::iterator itg=maximalConesOfG.begin();
968 itg != maximalConesOfG.end(); itg++)
969 zr.insert(intersection(*itf,*itg));
970
971 return zr;
972}
int i
Definition: cfEzgcd.cc:132
#define assume(x)
Definition: mod2.h:389

◆ getAmbientDimension()

int getAmbientDimension ( gfan::ZFan *  zf)

Definition at line 246 of file bbfan.cc.

247{
248 return zf->getAmbientDimension();
249}

◆ getCodimension()

int getCodimension ( gfan::ZFan *  zf)

Definition at line 251 of file bbfan.cc.

252{
253 return zf->getCodimension();
254}

◆ getDimension()

int getDimension ( gfan::ZFan *  zf)

Definition at line 256 of file bbfan.cc.

257{
258 return zf->getDimension();
259}

◆ getLinealityDimension()

int getLinealityDimension ( gfan::ZFan *  zf)

Definition at line 261 of file bbfan.cc.

262{
263 return zf->getLinealityDimension();
264}

◆ isCompatible()

bool isCompatible ( const gfan::ZFan *  zf,
const gfan::ZCone *  zc 
)

Definition at line 352 of file bbfan.cc.

353{
354 bool b = (zf->getAmbientDimension() == zc->ambientDimension());
355 if(b)
356 {
357 for (int d=0; d<=zf->getAmbientDimension(); d++)
358 {
359 for (int i=0; i<zf->numberOfConesOfDimension(d,0,1); i++)
360 {
361 gfan::ZCone zd = zf->getCone(d,i,0,1);
362 gfan::ZCone zt = gfan::intersection(*zc,zd);
363 zt.canonicalize();
364 b = b && zd.hasFace(zt);
365 }
366 }
367 }
368 return b;
369}

◆ isSimplicial()

int isSimplicial ( gfan::ZFan *  zf)

Definition at line 682 of file bbfan.cc.

683{
684 int i = zf->isSimplicial() ? 1 : 0;
685 return i;
686}

◆ rays()

gfan::Matrix< gfan::Integer > rays ( const gfan::ZFan *const  zf)

Definition at line 737 of file bbfan.cc.

738{
739 gfan::ZMatrix rays(0,zf->getAmbientDimension());
740 for (int i=0; i<zf->numberOfConesOfDimension(1,0,0); i++)
741 {
742 gfan::ZCone zc = zf->getCone(1, i, 0, 0);
743 rays.append(zc.extremeRays());
744 }
745 return rays;
746}
gfan::ZMatrix rays(const gfan::ZFan *const zf)
Definition: bbfan.cc:737

Variable Documentation

◆ fanID

EXTERN_VAR int fanID

Definition at line 12 of file bbfan.h.