Loading...
Searching...
No Matches
bbfan.cc File Reference
`#include "kernel/mod2.h"`
`#include "misc/intvec.h"`
`#include "coeffs/coeffs.h"`
`#include "coeffs/bigintmat.h"`
`#include "Singular/ipid.h"`
`#include "Singular/ipshell.h"`
`#include "Singular/blackbox.h"`
`#include "Singular/links/ssiLink.h"`
`#include "callgfanlib_conversion.h"`
`#include "bbfan.h"`
`#include "gfan.h"`

Go to the source code of this file.

## Functions

void * | bbfan_Init (blackbox *)
void | bbfan_destroy (blackbox *, void *d)
char * | bbfan_String (blackbox *, void *d)
void * | bbfan_Copy (blackbox *, void *d)
BOOLEAN | bbfan_Assign (leftv l, leftv r)
static gfan::IntMatrix | permutationIntMatrix (const bigintmat *iv)
static BOOLEAN | jjFANEMPTY_I (leftv res, leftv v)
static BOOLEAN | jjFANEMPTY_IM (leftv res, leftv v)
BOOLEAN | emptyFan (leftv res, leftv args)
static BOOLEAN | jjFANFULL_I (leftv res, leftv v)
static BOOLEAN | jjFANFULL_IM (leftv res, leftv v)
BOOLEAN | fullFan (leftv res, leftv args)
int | getAmbientDimension (gfan::ZFan *zf)
int | getCodimension (gfan::ZFan *zf)
int | getDimension (gfan::ZFan *zf)
int | getLinealityDimension (gfan::ZFan *zf)
BOOLEAN | numberOfConesOfDimension (leftv res, leftv args)
BOOLEAN | ncones (leftv res, leftv args)
BOOLEAN | nmaxcones (leftv res, leftv args)
bool | isCompatible (const gfan::ZFan *zf, const gfan::ZCone *zc)
BOOLEAN | isCompatible (leftv res, leftv args)
BOOLEAN | insertCone (leftv res, leftv args)
bool | containsInCollection (gfan::ZFan *zf, gfan::ZCone *zc)
BOOLEAN | containsInCollection (leftv res, leftv args)
BOOLEAN | removeCone (leftv res, leftv args)
BOOLEAN | getCone (leftv res, leftv args)
BOOLEAN | getCones (leftv res, leftv args)
int | isSimplicial (gfan::ZFan *zf)
BOOLEAN | isPure (leftv res, leftv args)
BOOLEAN | fVector (leftv res, leftv args)
gfan::ZMatrix | rays (const gfan::ZFan *const zf)
int | numberOfConesWithVector (gfan::ZFan *zf, gfan::ZVector *v)
BOOLEAN | numberOfConesWithVector (leftv res, leftv args)
BOOLEAN | fanFromString (leftv res, leftv args)
BOOLEAN | fanViaCones (leftv res, leftv args)
gfan::ZFan | commonRefinement (gfan::ZFan zf, gfan::ZFan zg)
BOOLEAN | commonRefinement (leftv res, leftv args)
BOOLEAN | bbfan_serialize (blackbox *b, void *d, si_link f)
BOOLEAN | bbfan_deserialize (blackbox **b, void **d, si_link f)
void | bbfan_setup (SModulFunctions *p)

## Variables

VAR int | fanID

## Function Documentation

## bbfan_Assign()

BOOLEAN bbfan_Assign | ( | leftv | l,
|  | leftv | r )

Definition at line 71 of file bbfan.cc.

{
gfan::ZFan* newZf;
if (r==NULL)
{
if (l->Data()!=NULL)
{
gfan::ZFan* zd = (gfan::ZFan*) l->Data();
delete zd;
}
newZf = new gfan::ZFan(0);
}
else if (r->Typ()==l->Typ())
{
if (l->Data()!=NULL)
{
gfan::ZFan* zd = (gfan::ZFan*) l->Data();
delete zd;
}
newZf = (gfan::ZFan*) r->CopyD();
}
else if (r->Typ()==INT_CMD)
{
int ambientDim = (int) (long) r->Data();
if (ambientDim < 0)
{
Werror("expected an int >= 0, but got %d", ambientDim);
return TRUE;
}
if (l->Data()!=NULL)
{
gfan::ZFan* zd = (gfan::ZFan*) l->Data();
delete zd;
}
newZf = new gfan::ZFan(ambientDim);
}
else
{
Werror("assign Type(%d) = Type(%d) not implemented",l->Typ(),r->Typ());
return TRUE;
}
if (l->rtyp==IDHDL)
{
IDDATA((idhdl)l->data) = (char*) newZf;
}
else
{
l->data = (void*) newZf;
}
return FALSE;
}
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
l
int l
Definition cfEzgcd.cc:100
sleftv::CopyD
void * CopyD(int t)
Definition subexpr.cc:714
sleftv::Typ
int Typ()
Definition subexpr.cc:1048
sleftv::Data
void * Data()
Definition subexpr.cc:1192
IDDATA
#define IDDATA(a)
Definition ipid.h:126
NULL
#define NULL
Definition omList.c:12
Werror
void Werror(const char *fmt,...)
Definition reporter.cc:189
idhdl
idrec * idhdl
Definition ring.h:22
IDHDL
#define IDHDL
Definition tok.h:31
INT_CMD
@ INT_CMD
Definition tok.h:96

## bbfan_Copy()

void * bbfan_Copy | ( | blackbox * | ,
|  | void * | d )

Definition at line 64 of file bbfan.cc.

{
gfan::ZFan* zf = (gfan::ZFan*)d;
gfan::ZFan* newZf = new gfan::ZFan(*zf);
return newZf;
}

## bbfan_deserialize()

BOOLEAN bbfan_deserialize | ( | blackbox ** | b,
|  | void ** | d,
|  | si_link | f )

Definition at line 1063 of file bbfan.cc.

{
ssiInfo *dd = (ssiInfo *)f->data;
int l = s_readint(dd->f_read);
char* buf = (char*) omAlloc0(l+1);
(void) s_getc(dd->f_read); // skip whitespace
(void) s_readbytes(buf,l,dd->f_read);
buf[l]='\0';
std::istringstream fanInString(std::string(buf,l));
gfan::ZFan* zf = new gfan::ZFan(fanInString);
*d=zf;
omFree(buf);
return FALSE;
}
f
FILE * f
Definition checklibs.c:9
omFree
#define omFree(addr)
Definition omAllocDecl.h:261
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211
s_getc
int s_getc(s_buff F)
Definition s_buff.cc:59
s_readint
int s_readint(s_buff F)
Definition s_buff.cc:113
s_readbytes
int s_readbytes(char *buff, int len, s_buff F)
Definition s_buff.cc:203
ssiInfo
Definition s_buff.h:21
buf
int status int void * buf
Definition si_signals.h:69

## bbfan_destroy()

void bbfan_destroy | ( | blackbox * | ,
|  | void * | d )

Definition at line 26 of file bbfan.cc.

{
if (d!=NULL)
{
gfan::ZFan* zf = (gfan::ZFan*) d;
delete zf;
}
}

## bbfan_Init()

void * bbfan_Init | ( | blackbox * |  | ) |

Definition at line 21 of file bbfan.cc.

{
return (void*) new gfan::ZFan(0);
}

## bbfan_serialize()

BOOLEAN bbfan_serialize | ( | blackbox * | b,
|  | void * | d,
|  | si_link | f )

Definition at line 1044 of file bbfan.cc.

{
ssiInfo *dd = (ssiInfo *)f->data;
sleftv l;
memset(&l,0,sizeof(l));
l.rtyp=STRING_CMD;
l.data=(void*)"fan";
f->m->Write(f, &l);
gfan::ZFan* zf = (gfan::ZFan*) d;
std::string s = zf->toString(2+4+8+128);
fprintf(dd->f_write,"%d %s ",(int)s.size(),s.c_str());
return FALSE;
}
sleftv
Class used for (list of) interpreter objects.
Definition subexpr.h:83
s
const CanonicalForm int s
Definition facAbsFact.cc:51
STRING_CMD
@ STRING_CMD
Definition tok.h:187

## bbfan_setup()

void bbfan_setup | ( | SModulFunctions * | p | ) |

Definition at line 1082 of file bbfan.cc.

{
blackbox *b=(blackbox*)omAlloc0(sizeof(blackbox));
// all undefined entries will be set to default in setBlackboxStuff
// the default Print is quite usefule,
// all other are simply error messages
b->blackbox_destroy=bbfan_destroy;
b->blackbox_String=bbfan_String;
//b->blackbox_Print=blackbox_default_Print;
b->blackbox_Init=bbfan_Init;
b->blackbox_Copy=bbfan_Copy;
b->blackbox_Assign=bbfan_Assign;
b->blackbox_serialize=bbfan_serialize;
b->blackbox_deserialize=bbfan_deserialize;
p->iiAddCproc("gfan.lib","emptyFanInternal",FALSE,emptyFan);
p->iiAddCproc("gfan.lib","fullFanInternal",FALSE,fullFan);
/* the following functions are implemented in bbcone.cc */
// iiAddCproc("gfan.lib","containsInSupportInternal",FALSE,containsInSupport);
// iiAddCproc("gfan.lib","getAmbientDimensionInternal",FALSE,getAmbientDimension);
// iiAddCproc("gfan.lib","getCodimensionInternal",FALSE,getDimension);
// iiAddCproc("gfan.lib","getDimensionInternal",FALSE,getDimension);
// iiAddCproc("gfan.lib","getLinealityDimensionInternal",FALSE,getLinealityDimension);
// iiAddCproc("gfan.lib","isSimplicialInternal",FALSE,isSimplicial);
/********************************************************/
p->iiAddCproc("gfan.lib","isCompatibleInternal",FALSE,isCompatible);
p->iiAddCproc("gfan.lib","numberOfConesOfDimensionInternal",FALSE,numberOfConesOfDimension);
p->iiAddCproc("gfan.lib","nconesInternal",FALSE,ncones);
p->iiAddCproc("gfan.lib","nmaxconesInternal",FALSE,nmaxcones);
p->iiAddCproc("gfan.lib","insertConeInternal",FALSE,insertCone);
p->iiAddCproc("gfan.lib","removeConeInternal",FALSE,removeCone);
p->iiAddCproc("gfan.lib","getConeInternal",FALSE,getCone);
p->iiAddCproc("gfan.lib","getConesInternal",FALSE,getCones);
p->iiAddCproc("gfan.lib","isPureInternal",FALSE,isPure);
p->iiAddCproc("gfan.lib","fanFromStringInternal",FALSE,fanFromString);
p->iiAddCproc("gfan.lib","fanViaConesInternal",FALSE,fanViaCones);
p->iiAddCproc("gfan.lib","numberOfConesWithVectorInternal",FALSE,numberOfConesWithVector);
// iiAddCproc("gfan.lib","isCompleteInternal",FALSE,isComplete); not working as expected, should leave this to polymake
p->iiAddCproc("gfan.lib","fVectorInternal",FALSE,fVector);
p->iiAddCproc("gfan.lib","containsInCollectionInternal",FALSE,containsInCollection);
// p->iiAddCproc("gfan.lib","tropicalVarietyInternal",FALSE,tropicalVariety);
p->iiAddCproc("gfan.lib","commonRefinementInternal",FALSE,commonRefinement);
// iiAddCproc("gfan.lib","grFanInternal",FALSE,grFan);
fanID=setBlackboxStuff(b,"fan");
//Print("created type %d (fan)\n",fanID);
}
nmaxcones
BOOLEAN nmaxcones(leftv res, leftv args)
Definition bbfan.cc:331
numberOfConesOfDimension
BOOLEAN numberOfConesOfDimension(leftv res, leftv args)
Definition bbfan.cc:266
emptyFan
BOOLEAN emptyFan(leftv res, leftv args)
Definition bbfan.cc:176
fanViaCones
BOOLEAN fanViaCones(leftv res, leftv args)
Definition bbfan.cc:814
containsInCollection
bool containsInCollection(gfan::ZFan *zf, gfan::ZCone *zc)
Definition bbfan.cc:433
fullFan
BOOLEAN fullFan(leftv res, leftv args)
Definition bbfan.cc:228
getCones
BOOLEAN getCones(leftv res, leftv args)
Definition bbfan.cc:609
bbfan_String
char * bbfan_String(blackbox *, void *d)
Definition bbfan.cc:35
fanFromString
BOOLEAN fanFromString(leftv res, leftv args)
Definition bbfan.cc:796
isPure
BOOLEAN isPure(leftv res, leftv args)
Definition bbfan.cc:688
bbfan_Copy
void * bbfan_Copy(blackbox *, void *d)
Definition bbfan.cc:64
numberOfConesWithVector
int numberOfConesWithVector(gfan::ZFan *zf, gfan::ZVector *v)
Definition bbfan.cc:748
ncones
BOOLEAN ncones(leftv res, leftv args)
Definition bbfan.cc:309
bbfan_deserialize
BOOLEAN bbfan_deserialize(blackbox **b, void **d, si_link f)
Definition bbfan.cc:1063
removeCone
BOOLEAN removeCone(leftv res, leftv args)
Definition bbfan.cc:514
bbfan_destroy
void bbfan_destroy(blackbox *, void *d)
Definition bbfan.cc:26
fanID
VAR int fanID
Definition bbfan.cc:19
commonRefinement
gfan::ZFan commonRefinement(gfan::ZFan zf, gfan::ZFan zg)
Definition bbfan.cc:948
bbfan_Init
void * bbfan_Init(blackbox *)
Definition bbfan.cc:21
getCone
BOOLEAN getCone(leftv res, leftv args)
Definition bbfan.cc:553
bbfan_Assign
BOOLEAN bbfan_Assign(leftv l, leftv r)
Definition bbfan.cc:71
bbfan_serialize
BOOLEAN bbfan_serialize(blackbox *b, void *d, si_link f)
Definition bbfan.cc:1044
isCompatible
bool isCompatible(const gfan::ZFan *zf, const gfan::ZCone *zc)
Definition bbfan.cc:352
insertCone
BOOLEAN insertCone(leftv res, leftv args)
Definition bbfan.cc:393
fVector
BOOLEAN fVector(leftv res, leftv args)
Definition bbfan.cc:720
setBlackboxStuff
int setBlackboxStuff(blackbox *bb, const char *n)
define a new type
Definition blackbox.cc:143
p
int p
Definition cfModGcd.cc:4086
b
CanonicalForm b
Definition cfModGcd.cc:4111

## bbfan_String()

char * bbfan_String | ( | blackbox * | ,
|  | void * | d )

Definition at line 35 of file bbfan.cc.

{
if (d==NULL) return omStrDup("invalid object");
else
{
gfan::initializeCddlibIfRequired();
gfan::ZFan* zf = (gfan::ZFan*)d;
std::string s = zf->toString(2+4+8+128);
gfan::deinitializeCddlibIfRequired();
return omStrDup(s.c_str());
// =======
// std::stringstream s;
// std::string raysAndCones = zf->toStringJustRaysAndMaximalCones();
// s << raysAndCones;
// if (zf->getDimension() >= 0) // <=> zf is not empty
// {
// assert(zf->numberOfConesOfDimension(zf->getDimension()-zf->getLinealityDimension(),0,0));
// gfan::ZCone zc = zf->getCone(zf->getDimension()-zf->getLinealityDimension(),0,0,0);
// gfan::ZMatrix genLinSpace = zc.generatorsOfLinealitySpace();
// char* gens = toString(genLinSpace);
// s << std::endl << "GENERATORS_LINEALITY_SPACE:" << std::endl;
// s << gens;
// }
// std::string sstring = s.str();
// return omStrDup(sstring.c_str());
// >>>>>>> status updated 11.03.
}
}
omStrDup
#define omStrDup(s)
Definition omAllocDecl.h:263

## commonRefinement() [1/2]

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

Definition at line 948 of file bbfan.cc.

{
assume(zf.getAmbientDimension() == zg.getAmbientDimension());
// gather all maximal cones of f and g
std::list<gfan::ZCone> maximalConesOfF;
for (int d=0; d<=zf.getAmbientDimension(); d++)
for (int i=0; i<zf.numberOfConesOfDimension(d,0,1); i++)
maximalConesOfF.push_back(zf.getCone(d,i,0,1));
std::list<gfan::ZCone> maximalConesOfG;
for (int d=0; d<=zg.getAmbientDimension(); d++)
for (int i=0; i<zg.numberOfConesOfDimension(d,0,1); i++)
maximalConesOfG.push_back(zg.getCone(d,i,0,1));
// construct a new fan out of their intersections
gfan::ZFan zr = gfan::ZFan(zf.getAmbientDimension());
for (std::list<gfan::ZCone>::iterator itf=maximalConesOfF.begin();
itf != maximalConesOfF.end(); itf++)
for (std::list<gfan::ZCone>::iterator itg=maximalConesOfG.begin();
itg != maximalConesOfG.end(); itg++)
zr.insert(intersection(*itf,*itg));
return zr;
}
i
int i
Definition cfEzgcd.cc:132
assume
#define assume(x)
Definition mod2.h:389

## commonRefinement() [2/2]

BOOLEAN commonRefinement | ( | leftv | res,
|  | leftv | args )

Definition at line 974 of file bbfan.cc.

{
leftv u=args;
if ((u != NULL) && (u->Typ() == fanID))
{
leftv v=u->next;
if ((v != NULL) && (v->Typ() == fanID))
{
gfan::initializeCddlibIfRequired();
gfan::ZFan* zf = (gfan::ZFan*) u->Data();
gfan::ZFan* zg = (gfan::ZFan*) v->Data();
gfan::ZFan* zr = new gfan::ZFan(commonRefinement(*zf,*zg));
res->rtyp = fanID;
res->data = (void*) zr;
gfan::deinitializeCddlibIfRequired();
return FALSE;
}
}
WerrorS("commonRefinement: unexpected parameters");
return TRUE;
}
sleftv::next
leftv next
Definition subexpr.h:86
res
CanonicalForm res
Definition facAbsFact.cc:60
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
leftv
sleftv * leftv
Definition structs.h:53

## containsInCollection() [1/2]

bool containsInCollection | ( | gfan::ZFan * | zf,
|  | gfan::ZCone * | zc )

Definition at line 433 of file bbfan.cc.

{
gfan::ZVector zv=zc->getRelativeInteriorPoint();
for (int d=0; d<=zf->getAmbientDimension(); d++)
{
for (int i=0; i<zf->numberOfConesOfDimension(d,0,1); i++)
{
gfan::ZCone zd = zf->getCone(d,i,0,1);
zd.canonicalize();
if (zd.containsRelatively(zv))
{
gfan::ZCone temp = *zc;
temp.canonicalize();
return (!(zd != temp));
}
}
}
return 0;
}

## containsInCollection() [2/2]

BOOLEAN containsInCollection | ( | leftv | res,
|  | leftv | args )

Definition at line 453 of file bbfan.cc.

{
leftv u=args;
if ((u != NULL) && (u->Typ() == fanID))
{
leftv v=u->next;
if ((v != NULL) && (v->Typ() == coneID))
{
gfan::initializeCddlibIfRequired();
gfan::ZFan* zf = (gfan::ZFan*)u->Data();
gfan::ZCone* zc = (gfan::ZCone*)v->Data();
if((zf->getAmbientDimension() == zc->ambientDimension()))
{
res->rtyp = INT_CMD;
res->data = (void*) (long) (int) containsInCollection(zf,zc);
gfan::deinitializeCddlibIfRequired();
return FALSE;
}
gfan::deinitializeCddlibIfRequired();
WerrorS("containsInCollection: mismatching ambient dimensions");
return TRUE;
}
}
WerrorS("containsInCollection: unexpected parameters");
return TRUE;
}
coneID
VAR int coneID
Definition bbcone.cc:25

## emptyFan()

BOOLEAN emptyFan | ( | leftv | res,
|  | leftv | args )

Definition at line 176 of file bbfan.cc.

{
leftv u = args;
if (u == NULL)
{
res->rtyp = fanID;
res->data = (void*) new gfan::ZFan(0);
return FALSE;
}
if ((u != NULL) && (u->Typ() == INT_CMD))
{
if (u->next == NULL) return jjFANEMPTY_I(res, u);
}
if ((u != NULL) && (u->Typ() == BIGINTMAT_CMD))
{
if (u->next == NULL) return jjFANEMPTY_IM(res, u);
}
WerrorS("emptyFan: unexpected parameters");
return TRUE;
}
jjFANEMPTY_I
static BOOLEAN jjFANEMPTY_I(leftv res, leftv v)
Definition bbfan.cc:146
jjFANEMPTY_IM
static BOOLEAN jjFANEMPTY_IM(leftv res, leftv v)
Definition bbfan.cc:159
BIGINTMAT_CMD
@ BIGINTMAT_CMD
Definition grammar.cc:278

## fanFromString()

BOOLEAN fanFromString | ( | leftv | res,
|  | leftv | args )

Definition at line 796 of file bbfan.cc.

{
leftv u=args;
if ((u != NULL) && (u->Typ() == STRING_CMD))
{
gfan::initializeCddlibIfRequired();
std::string fanInString = (char*) u->Data();
std::istringstream s(fanInString);
gfan::ZFan* zf = new gfan::ZFan(s);
res->rtyp = fanID;
res->data = (void*) zf;
gfan::deinitializeCddlibIfRequired();
return FALSE;
}
WerrorS("fanFromString: unexpected parameters");
return TRUE;
}

## fanViaCones()

BOOLEAN fanViaCones | ( | leftv | res,
|  | leftv | args )

Definition at line 814 of file bbfan.cc.

{
leftv u=args;
if ((u != NULL) && (u->Typ() == LIST_CMD))
{
lists L = (lists) u->Data();
if (lSize(L)>-1)
{
gfan::initializeCddlibIfRequired();
if (L->m[0].Typ() != coneID)
{
WerrorS("fanViaCones: list contains entries of wrong type");
return TRUE;
}
gfan::ZCone* zc = (gfan::ZCone*) L->m[0].Data();
gfan::ZFan* zf = new gfan::ZFan(zc->ambientDimension());
zf->insert(*zc);
for (int i=1; i<=lSize(L); i++)
{
if (L->m[i].Typ() != coneID)
{
WerrorS("fanViaCones: entries of wrong type in list");
gfan::deinitializeCddlibIfRequired();
return TRUE;
}
gfan::ZCone* zc = (gfan::ZCone*) L->m[i].Data();
if (zc->ambientDimension() != zf->getAmbientDimension())
{
WerrorS("fanViaCones: inconsistent ambient dimensions amongst cones in list");
gfan::deinitializeCddlibIfRequired();
return TRUE;
}
zf->insert(*zc);
}
res->rtyp = fanID;
res->data = (void*) zf;
gfan::deinitializeCddlibIfRequired();
return FALSE;
}
res->rtyp = fanID;
res->data = (void*) new gfan::ZFan(0);
return FALSE;
}
if ((u != NULL) && (u->Typ() == coneID))
{
gfan::initializeCddlibIfRequired();
gfan::ZCone* zc = (gfan::ZCone*) u->Data();
gfan::ZFan* zf = new gfan::ZFan(zc->ambientDimension());
zf->insert(*zc);
while (u->next != NULL)
{
u = u->next;
if (u->Typ() != coneID)
{
WerrorS("fanViaCones: arguments of wrong type");
gfan::deinitializeCddlibIfRequired();
delete zf;
return TRUE;
}
gfan::ZCone* zc = (gfan::ZCone*) u->Data();
if (zc->ambientDimension() != zf->getAmbientDimension())
{
WerrorS("fanViaCones: inconsistent ambient dimensions amongst input cones");
gfan::deinitializeCddlibIfRequired();
delete zf;
return TRUE;
}
zf->insert(*zc);
}
res->rtyp = fanID;
res->data = (void*) zf;
gfan::deinitializeCddlibIfRequired();
return FALSE;
}
if (u == NULL)
{
res->rtyp = fanID;
res->data = (void*) new gfan::ZFan(0);
return FALSE;
}
WerrorS("fanViaCones: unexpected parameters");
return TRUE;
}
slists::m
sleftv * m
Definition lists.h:46
lSize
int lSize(lists L)
Definition lists.cc:25
lists
slists * lists
Definition mpr_numeric.h:146
LIST_CMD
@ LIST_CMD
Definition tok.h:118

## fullFan()

BOOLEAN fullFan | ( | leftv | res,
|  | leftv | args )

Definition at line 228 of file bbfan.cc.

{
gfan::initializeCddlibIfRequired();
leftv u = args;
if (u == NULL)
{
res->rtyp = fanID;
res->data = (void*) new gfan::ZFan(0);
return FALSE;
}
if ((u != NULL) && (u->Typ() == INT_CMD))
if (u->next == NULL) return jjFANFULL_I(res, u);
if ((u != NULL) && (u->Typ() == BIGINTMAT_CMD))
if (u->next == NULL) return jjFANFULL_IM(res, u);
WerrorS("fullFan: unexpected parameters");
return TRUE;
}
jjFANFULL_I
static BOOLEAN jjFANFULL_I(leftv res, leftv v)
Definition bbfan.cc:197
jjFANFULL_IM
static BOOLEAN jjFANFULL_IM(leftv res, leftv v)
Definition bbfan.cc:210

## fVector()

BOOLEAN fVector | ( | leftv | res,
|  | leftv | args )

Definition at line 720 of file bbfan.cc.

{
leftv u=args;
if ((u != NULL) && (u->Typ() == fanID))
{
gfan::initializeCddlibIfRequired();
gfan::ZFan* zf = (gfan::ZFan*) u->Data();
gfan::ZVector zv=zf->getFVector();
res->rtyp = BIGINTMAT_CMD;
res->data = (void*) zVectorToBigintmat(zv);
gfan::deinitializeCddlibIfRequired();
return FALSE;
}
WerrorS("fVector: unexpected parameters");
return TRUE;
}
zVectorToBigintmat
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
Definition callgfanlib_conversion.cc:21

## getAmbientDimension()

int getAmbientDimension | ( | gfan::ZFan * | zf | ) |

Definition at line 246 of file bbfan.cc.

{
return zf->getAmbientDimension();
}

## getCodimension()

int getCodimension | ( | gfan::ZFan * | zf | ) |

Definition at line 251 of file bbfan.cc.

{
return zf->getCodimension();
}

## getCone()

BOOLEAN getCone | ( | leftv | res,
|  | leftv | args )

Definition at line 553 of file bbfan.cc.

{
leftv u=args;
if ((u != NULL) && (u->Typ() == fanID))
{
leftv v=u->next;
if ((v != NULL) && (v->Typ() == INT_CMD))
{
leftv w=v->next;
if ((w != NULL) && (w->Typ() == INT_CMD))
{
gfan::initializeCddlibIfRequired();
gfan::ZFan* zf = (gfan::ZFan*) u->Data();
int d = (int)(long)v->Data();
d -= zf->getLinealityDimension(); // shifting by dimension of lineality space
// since gfan always regards the lineality space as zero-dimensional
int i = (int)(long)w->Data();
i -= 1; // shifting by one, since gfan starts counting at 0
int m = 0;
leftv x=w->next;
if ((x != NULL) && (x->Typ() != INT_CMD))
{
WerrorS("getCone: invalid maximality flag");
gfan::deinitializeCddlibIfRequired();
return TRUE;
}
if ((x != NULL) && (x->Typ() == INT_CMD))
m = (int)(long) x->Data();
bool mm = (bool) m;
if (d<0 || (d>zf->getAmbientDimension()-zf->getLinealityDimension()))
{
WerrorS("getCone: invalid dimension");
gfan::deinitializeCddlibIfRequired();
return TRUE;
}
if (i<0 || i>=zf->numberOfConesOfDimension(d,0,mm))
{
WerrorS("getCone: invalid index");
gfan::deinitializeCddlibIfRequired();
return TRUE;
}
gfan::ZCone zc = zf->getCone(d,i,0,mm);
res->rtyp = coneID;
res->data = (void*)new gfan::ZCone(zc);
gfan::deinitializeCddlibIfRequired();
return FALSE;
}
}
}
WerrorS("getCone: unexpected parameters");
return TRUE;
}
m
int m
Definition cfEzgcd.cc:128
x
Variable x
Definition cfModGcd.cc:4090
w
const CanonicalForm & w
Definition facAbsFact.cc:51

## getCones()

BOOLEAN getCones | ( | leftv | res,
|  | leftv | args )

Definition at line 609 of file bbfan.cc.

{
leftv u=args;
if ((u != NULL) && (u->Typ() == fanID))
{
leftv v=u->next;
if ((v != NULL) && (v->Typ() == INT_CMD))
{
gfan::initializeCddlibIfRequired();
gfan::ZFan* zf = (gfan::ZFan*) u->Data();
int d = (int)(long)v->Data();
int o = -1;
int m = -1;
leftv w=v->next;
if ((w != NULL) && (w->Typ() == INT_CMD))
{
o = (int)(long)w->Data();
leftv x=w->next;
if ((x != NULL) && (x->Typ() == INT_CMD))
{
m = (int)(long)x->Data();
}
}
if (o == -1) o = 0;
if (m == -1) m = 0;
if (((o == 0) || (o == 1)) && ((m == 0) || (m == 1)))
{
bool oo = (bool) o;
bool mm = (bool) m;
if (0<=d && d<=zf->getAmbientDimension())
{
int ld = zf->getLinealityDimension();
if (d-ld>=0)
{
lists L = (lists)omAllocBin(slists_bin);
int n = zf->numberOfConesOfDimension(d-ld,oo,mm);
L->Init(n);
for (int i=0; i<n; i++)
{
gfan::ZCone zc = zf->getCone(d-ld,i,oo,mm);
L->m[i].rtyp = coneID; L->m[i].data=(void*) new gfan::ZCone(zc);
}
res->rtyp = LIST_CMD;
res->data = (void*) L;
gfan::deinitializeCddlibIfRequired();
return FALSE;
}
else
{
WerrorS("getCones: invalid dimension; no cones in this dimension");
gfan::deinitializeCddlibIfRequired();
return TRUE;
}
}
else
{
WerrorS("getCones: invalid dimension");
gfan::deinitializeCddlibIfRequired();
return TRUE;
}
}
else
{
WerrorS("getCones: invalid specifier for orbit or maximal");
gfan::deinitializeCddlibIfRequired();
return TRUE;
}
}
}
WerrorS("getCones: unexpected parameters");
return TRUE;
}
getAmbientDimension
int getAmbientDimension(gfan::ZFan *zf)
Definition bbfan.cc:246
sleftv::rtyp
int rtyp
Definition subexpr.h:91
sleftv::data
void * data
Definition subexpr.h:88
slists::Init
INLINE_THIS void Init(int l=0)
slists_bin
VAR omBin slists_bin
Definition lists.cc:23
omAllocBin
#define omAllocBin(bin)
Definition omAllocDecl.h:205

## getDimension()

int getDimension | ( | gfan::ZFan * | zf | ) |

Definition at line 256 of file bbfan.cc.

{
return zf->getDimension();
}

## getLinealityDimension()

int getLinealityDimension | ( | gfan::ZFan * | zf | ) |

Definition at line 261 of file bbfan.cc.

{
return zf->getLinealityDimension();
}

## insertCone()

BOOLEAN insertCone | ( | leftv | res,
|  | leftv | args )

Definition at line 393 of file bbfan.cc.

{
leftv u=args;
if ((u != NULL) && ((u->rtyp==IDHDL) || (u->rtyp==ALIAS_CMD)) && (u->e==NULL) && (u->Typ() == fanID))
{
leftv v=u->next;
if ((v != NULL) && (v->Typ() == coneID))
{
gfan::initializeCddlibIfRequired();
gfan::ZFan* zf = (gfan::ZFan*)u->Data();
gfan::ZCone* zc = (gfan::ZCone*)v->Data();
zc->canonicalize();
leftv w=v->next;
int n=1;
if ((w != NULL) && (w->Typ() == INT_CMD))
n = (int)(long) w->Data();
if (n != 0)
{
if (!isCompatible(zf,zc))
{
WerrorS("insertCone: cone and fan not compatible");
gfan::deinitializeCddlibIfRequired();
return TRUE;
}
}
zf->insert(*zc);
res->rtyp = NONE;
res->data = NULL;
IDDATA((idhdl)u->data) = (char*) zf;
gfan::deinitializeCddlibIfRequired();
return FALSE;
}
}
WerrorS("insertCone: unexpected parameters");
return TRUE;
}
sleftv::e
Subexpr e
Definition subexpr.h:105
ALIAS_CMD
@ ALIAS_CMD
Definition tok.h:34
NONE
#define NONE
Definition tok.h:223

## isCompatible() [1/2]

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

Definition at line 352 of file bbfan.cc.

{
bool b = (zf->getAmbientDimension() == zc->ambientDimension());
if(b)
{
for (int d=0; d<=zf->getAmbientDimension(); d++)
{
for (int i=0; i<zf->numberOfConesOfDimension(d,0,1); i++)
{
gfan::ZCone zd = zf->getCone(d,i,0,1);
gfan::ZCone zt = gfan::intersection(*zc,zd);
zt.canonicalize();
b = b && zd.hasFace(zt);
}
}
}
return b;
}

## isCompatible() [2/2]

BOOLEAN isCompatible | ( | leftv | res,
|  | leftv | args )

Definition at line 371 of file bbfan.cc.

{
leftv u=args;
if ((u != NULL) && (u->Typ() == fanID))
{
leftv v=u->next;
if ((v != NULL) && (v->Typ() == coneID))
{
gfan::initializeCddlibIfRequired();
gfan::ZFan* zf = (gfan::ZFan*)u->Data();
gfan::ZCone* zc = (gfan::ZCone*)v->Data();
int b = isCompatible(zf,zc);
res->rtyp = INT_CMD;
res->data = (void*) (long) b;
gfan::deinitializeCddlibIfRequired();
return FALSE;
}
}
WerrorS("isCompatible: unexpected parameters");
return TRUE;
}

## isPure()

BOOLEAN isPure | ( | leftv | res,
|  | leftv | args )

Definition at line 688 of file bbfan.cc.

{
leftv u=args;
if ((u != NULL) && (u->Typ() == fanID))
{
gfan::initializeCddlibIfRequired();
gfan::ZFan* zf = (gfan::ZFan*) u->Data();
int b = zf->isPure();
res->rtyp = INT_CMD;
res->data = (void*) (long) b;
gfan::deinitializeCddlibIfRequired();
return FALSE;
}
WerrorS("isPure: unexpected parameters");
return TRUE;
}

## isSimplicial()

int isSimplicial | ( | gfan::ZFan * | zf | ) |

Definition at line 682 of file bbfan.cc.

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

## jjFANEMPTY_I()

BOOLEAN jjFANEMPTY_I | ( | leftv | res,
|  | leftv | v )

static

Definition at line 146 of file bbfan.cc.

{
int ambientDim = (int)(long)v->Data();
if (ambientDim < 0)
{
Werror("expected non-negative ambient dim but got %d", ambientDim);
return TRUE;
}
res->rtyp = fanID;
res->data = (void*)(new gfan::ZFan(ambientDim));
return FALSE;
}

## jjFANEMPTY_IM()

BOOLEAN jjFANEMPTY_IM | ( | leftv | res,
|  | leftv | v )

static

Definition at line 159 of file bbfan.cc.

{
bigintmat* permutations = (bigintmat*)v->Data();
int ambientDim = permutations->cols();
gfan::IntMatrix im = permutationIntMatrix(permutations);
if (!gfan::Permutation::arePermutations(im))
{
Werror("provided bigintmat contains invalid permutations of {1, ..., %d}", ambientDim);
return TRUE;
}
gfan::SymmetryGroup sg = gfan::SymmetryGroup(ambientDim);
sg.computeClosure(im);
res->rtyp = fanID;
res->data = (void*)(new gfan::ZFan(sg));
return FALSE;
}
permutationIntMatrix
static gfan::IntMatrix permutationIntMatrix(const bigintmat *iv)
Definition bbfan.cc:127
bigintmat
Matrices of numbers.
Definition bigintmat.h:51
bigintmat::cols
int cols() const
Definition bigintmat.h:144

## jjFANFULL_I()

BOOLEAN jjFANFULL_I | ( | leftv | res,
|  | leftv | v )

static

Definition at line 197 of file bbfan.cc.

{
int ambientDim = (int)(long)v->Data();
if (ambientDim < 0)
{
Werror("expected non-negative ambient dim but got %d", ambientDim);
return TRUE;
}
gfan::ZFan* zf = new gfan::ZFan(gfan::ZFan::fullFan(ambientDim));
res->rtyp = fanID;
res->data = (void*) zf;
return FALSE;
}

## jjFANFULL_IM()

BOOLEAN jjFANFULL_IM | ( | leftv | res,
|  | leftv | v )

static

Definition at line 210 of file bbfan.cc.

{
bigintmat* permutations = (bigintmat*)v->Data();
int ambientDim = permutations->cols();
gfan::IntMatrix im = permutationIntMatrix(permutations);
if (!gfan::Permutation::arePermutations(im))
{
Werror("provided bigintmat contains invalid permutations of {1, ..., %d}", ambientDim);
return TRUE;
}
gfan::SymmetryGroup sg = gfan::SymmetryGroup(ambientDim);
sg.computeClosure(im);
gfan::ZFan* zf = new gfan::ZFan(gfan::ZFan::fullFan(sg));
res->rtyp = fanID;
res->data = (void*) zf;
return FALSE;
}

## ncones()

BOOLEAN ncones | ( | leftv | res,
|  | leftv | args )

Definition at line 309 of file bbfan.cc.

{
leftv u=args;
if ((u != NULL) && (u->Typ() == fanID))
{
gfan::initializeCddlibIfRequired();
gfan::ZFan* zf = (gfan::ZFan*)u->Data();
int d = zf->getAmbientDimension();
int n = 0;
for (int i=0; i<=d; i++)
n = n + zf->numberOfConesOfDimension(i,0,0);
res->rtyp = INT_CMD;
res->data = (void*) (long) n;
gfan::deinitializeCddlibIfRequired();
return FALSE;
}
WerrorS("ncones: unexpected parameters");
return TRUE;
}

## nmaxcones()

BOOLEAN nmaxcones | ( | leftv | res,
|  | leftv | args )

Definition at line 331 of file bbfan.cc.

{
leftv u=args;
if ((u != NULL) && (u->Typ() == fanID))
{
gfan::initializeCddlibIfRequired();
gfan::ZFan* zf = (gfan::ZFan*)u->Data();
int n = 0;
for (int d=0; d<=zf->getAmbientDimension(); d++)
n = n + zf->numberOfConesOfDimension(d,0,1);
res->rtyp = INT_CMD;
res->data = (void*) (long) n;
gfan::deinitializeCddlibIfRequired();
return FALSE;
}
WerrorS("nmaxcones: unexpected parameters");
return TRUE;
}

## numberOfConesOfDimension()

BOOLEAN numberOfConesOfDimension | ( | leftv | res,
|  | leftv | args )

Definition at line 266 of file bbfan.cc.

{
leftv u=args;
if ((u != NULL) && (u->Typ() == fanID))
{
leftv v=u->next;
if ((v != NULL) && (v->Typ() == INT_CMD))
{
gfan::initializeCddlibIfRequired();
gfan::ZFan* zf = (gfan::ZFan*) u->Data();
int d = (int)(long)v->Data();
d -= zf->getLinealityDimension(); // shifting by dimension of lineality space
// since gfan always regards the lineality space as zero-dimensional
int m = 0;
leftv w=v->next;
if ((w != NULL) && (w->Typ() != INT_CMD))
{
WerrorS("numberOfConesOfDimension: invalid maximality flag");
gfan::deinitializeCddlibIfRequired();
return TRUE;
}
if ((w != NULL) && (w->Typ() == INT_CMD))
m = (int)(long) w->Data();
bool mm = (bool) m;
if (d<0 || (d>zf->getAmbientDimension()-zf->getLinealityDimension()))
{
WerrorS("numberOfConesOfDimension: invalid dimension");
gfan::deinitializeCddlibIfRequired();
return TRUE;
}
int n = zf->numberOfConesOfDimension(d,0,mm);
res->rtyp = INT_CMD;
res->data = (void*) (long) n;
gfan::deinitializeCddlibIfRequired();
return FALSE;
}
}
WerrorS("numberOfConesOfDimension: unexpected parameters");
return TRUE;
}

## numberOfConesWithVector() [1/2]

int numberOfConesWithVector | ( | gfan::ZFan * | zf,
|  | gfan::ZVector * | v )

Definition at line 748 of file bbfan.cc.

{
int count = 0;
int ambientDim = zf->getAmbientDimension();
for (int i=0; i<zf->numberOfConesOfDimension(ambientDim, 0, 0); i++)
{
gfan::ZCone zc = zf->getCone(ambientDim, i, 0, 0);
if (zc.contains(*v))
{
count = count +1;
if (count > 1)
return count;
}
}
return count;
}
count
int status int void size_t count
Definition si_signals.h:69

## numberOfConesWithVector() [2/2]

BOOLEAN numberOfConesWithVector | ( | leftv | res,
|  | leftv | args )

Definition at line 765 of file bbfan.cc.

{
leftv u=args;
if ((u != NULL) && (u->Typ() == fanID))
{
leftv v=u->next;
if ((v != NULL) && (v->Typ() == BIGINTMAT_CMD))
{
gfan::initializeCddlibIfRequired();
gfan::ZFan* zf = (gfan::ZFan*) u->Data();
bigintmat* v0 = (bigintmat*) v->Data();
int ambientDim = zf->getAmbientDimension();
if (ambientDim != v0->cols())
{
WerrorS("numberOfConesWithVector: mismatching dimensions");
gfan::deinitializeCddlibIfRequired();
return TRUE;
}
gfan::ZVector* v1 = bigintmatToZVector(*v0);
int count = numberOfConesWithVector(zf, v1);
delete v1;
res->rtyp = INT_CMD;
res->data = (void*) (long) count;
gfan::deinitializeCddlibIfRequired();
return FALSE;
}
}
WerrorS("numberOfConesWithVector: unexpected parameters");
return TRUE;
}
bigintmatToZVector
gfan::ZVector * bigintmatToZVector(const bigintmat &bim)
Definition callgfanlib_conversion.cc:73

## permutationIntMatrix()

gfan::IntMatrix permutationIntMatrix | ( | const bigintmat * | iv | ) |

static

Definition at line 127 of file bbfan.cc.

{
int cc = iv->cols();
int rr = iv->rows();
bigintmat* ivCopy = new bigintmat(rr, cc, coeffs_BIGINT);
number temp1 = n_Init(1,coeffs_BIGINT);
for (int r = 1; r <= rr; r++)
for (int c = 1; c <= cc; c++)
{
number temp2 = n_Sub(IMATELEM(*iv, r, c),temp1,coeffs_BIGINT);
ivCopy->set(r,c,temp2);
n_Delete(&temp2,coeffs_BIGINT);
}
n_Delete(&temp1,coeffs_BIGINT);
gfan::ZMatrix* zm = bigintmatToZMatrix(ivCopy);
gfan::IntMatrix im = gfan::IntMatrix(gfan::ZToIntMatrix(*zm));
delete zm;
return im;
}
bigintmatToZMatrix
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
Definition callgfanlib_conversion.cc:57
bigintmat::rows
int rows() const
Definition bigintmat.h:145
n_Sub
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
Definition coeffs.h:658
n_Delete
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:461
n_Init
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition coeffs.h:541
ivCopy
intvec * ivCopy(const intvec *o)
Definition intvec.h:146
IMATELEM
#define IMATELEM(M, I, J)
Definition intvec.h:86
coeffs_BIGINT
VAR coeffs coeffs_BIGINT
Definition polys.cc:14

## rays()

gfan::ZMatrix rays | ( | const gfan::ZFan *const | zf | ) |

Definition at line 737 of file bbfan.cc.

{
gfan::ZMatrix rays(0,zf->getAmbientDimension());
for (int i=0; i<zf->numberOfConesOfDimension(1,0,0); i++)
{
gfan::ZCone zc = zf->getCone(1, i, 0, 0);
rays.append(zc.extremeRays());
}
return rays;
}
rays
BOOLEAN rays(leftv res, leftv args)
Definition bbcone.cc:662
rays
gfan::ZMatrix rays(const gfan::ZFan *const zf)
Definition bbfan.cc:737

## removeCone()

BOOLEAN removeCone | ( | leftv | res,
|  | leftv | args )

Definition at line 514 of file bbfan.cc.

{
leftv u=args;
if ((u != NULL) && (u->Typ() == fanID))
{
leftv v=u->next;
if ((v != NULL) && (v->Typ() == coneID))
{
gfan::initializeCddlibIfRequired();
gfan::ZFan* zf = (gfan::ZFan*)u->Data();
gfan::ZCone* zc = (gfan::ZCone*)v->Data();
zc->canonicalize();
leftv w=v->next; int n = 1;
if ((w != NULL) && (w->Typ() == INT_CMD))
n = (int)(long) w;
if (n != 0)
{
if (!containsInCollection(zf,zc))
{
WerrorS("removeCone: cone not contained in fan");
gfan::deinitializeCddlibIfRequired();
return TRUE;
}
}
zf->remove(*zc);
res->rtyp = NONE;
res->data = NULL;
IDDATA((idhdl)u->data) = (char*) zf;
gfan::deinitializeCddlibIfRequired();
return FALSE;
}
}
WerrorS("removeCone: unexpected parameters");
return TRUE;
}

## Variable Documentation

## fanID

VAR int fanID

Definition at line 19 of file bbfan.cc.