23 return (
void*)
new gfan::ZFan(0);
30 gfan::ZFan* zf = (gfan::ZFan*) d;
40 gfan::initializeCddlibIfRequired();
41 gfan::ZFan* zf = (gfan::ZFan*)d;
42 std::string
s = zf->toString(2+4+8+128);
43 gfan::deinitializeCddlibIfRequired();
66 gfan::ZFan* zf = (gfan::ZFan*)d;
67 gfan::ZFan* newZf =
new gfan::ZFan(*zf);
78 gfan::ZFan* zd = (gfan::ZFan*)
l->Data();
81 newZf =
new gfan::ZFan(0);
83 else if (r->
Typ()==
l->Typ())
87 gfan::ZFan* zd = (gfan::ZFan*)
l->Data();
90 newZf = (gfan::ZFan*) r->
CopyD();
94 int ambientDim = (int) (
long) r->
Data();
97 Werror(
"expected an int >= 0, but got %d", ambientDim);
102 gfan::ZFan* zd = (gfan::ZFan*)
l->Data();
105 newZf =
new gfan::ZFan(ambientDim);
109 Werror(
"assign Type(%d) = Type(%d) not implemented",
l->Typ(),r->
Typ());
119 l->data = (
void*) newZf;
133 for (
int r = 1; r <= rr; r++)
134 for (
int c = 1; c <= cc; c++)
142 gfan::IntMatrix im = gfan::IntMatrix(gfan::ZToIntMatrix(*zm));
148 int ambientDim = (int)(
long)
v->Data();
151 Werror(
"expected non-negative ambient dim but got %d", ambientDim);
155 res->data = (
void*)(
new gfan::ZFan(ambientDim));
162 int ambientDim = permutations->
cols();
164 if (!gfan::Permutation::arePermutations(im))
166 Werror(
"provided bigintmat contains invalid permutations of {1, ..., %d}", ambientDim);
169 gfan::SymmetryGroup sg = gfan::SymmetryGroup(ambientDim);
170 sg.computeClosure(im);
172 res->data = (
void*)(
new gfan::ZFan(sg));
182 res->data = (
void*)
new gfan::ZFan(0);
193 WerrorS(
"emptyFan: unexpected parameters");
199 int ambientDim = (int)(
long)
v->Data();
202 Werror(
"expected non-negative ambient dim but got %d", ambientDim);
205 gfan::ZFan* zf =
new gfan::ZFan(gfan::ZFan::fullFan(ambientDim));
207 res->data = (
void*) zf;
213 int ambientDim = permutations->
cols();
215 if (!gfan::Permutation::arePermutations(im))
217 Werror(
"provided bigintmat contains invalid permutations of {1, ..., %d}", ambientDim);
220 gfan::SymmetryGroup sg = gfan::SymmetryGroup(ambientDim);
221 sg.computeClosure(im);
222 gfan::ZFan* zf =
new gfan::ZFan(gfan::ZFan::fullFan(sg));
224 res->data = (
void*) zf;
230 gfan::initializeCddlibIfRequired();
235 res->data = (
void*)
new gfan::ZFan(0);
242 WerrorS(
"fullFan: unexpected parameters");
248 return zf->getAmbientDimension();
253 return zf->getCodimension();
258 return zf->getDimension();
263 return zf->getLinealityDimension();
274 gfan::initializeCddlibIfRequired();
275 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
276 int d = (int)(
long)
v->Data();
277 d -= zf->getLinealityDimension();
283 WerrorS(
"numberOfConesOfDimension: invalid maximality flag");
284 gfan::deinitializeCddlibIfRequired();
288 m = (int)(
long)
w->Data();
291 if (d<0 || (d>zf->getAmbientDimension()-zf->getLinealityDimension()))
293 WerrorS(
"numberOfConesOfDimension: invalid dimension");
294 gfan::deinitializeCddlibIfRequired();
298 int n = zf->numberOfConesOfDimension(d,0,mm);
300 res->data = (
void*) (
long) n;
301 gfan::deinitializeCddlibIfRequired();
305 WerrorS(
"numberOfConesOfDimension: unexpected parameters");
314 gfan::initializeCddlibIfRequired();
315 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
316 int d = zf->getAmbientDimension();
319 for (
int i=0;
i<=d;
i++)
320 n = n + zf->numberOfConesOfDimension(
i,0,0);
323 res->data = (
void*) (
long) n;
324 gfan::deinitializeCddlibIfRequired();
327 WerrorS(
"ncones: unexpected parameters");
336 gfan::initializeCddlibIfRequired();
337 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
340 for (
int d=0; d<=zf->getAmbientDimension(); d++)
341 n = n + zf->numberOfConesOfDimension(d,0,1);
344 res->data = (
void*) (
long) n;
345 gfan::deinitializeCddlibIfRequired();
348 WerrorS(
"nmaxcones: unexpected parameters");
354 bool b = (zf->getAmbientDimension() == zc->ambientDimension());
357 for (
int d=0; d<=zf->getAmbientDimension(); d++)
359 for (
int i=0;
i<zf->numberOfConesOfDimension(d,0,1);
i++)
361 gfan::ZCone zd = zf->getCone(d,
i,0,1);
362 gfan::ZCone zt = gfan::intersection(*zc,zd);
364 b =
b && zd.hasFace(zt);
379 gfan::initializeCddlibIfRequired();
380 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
381 gfan::ZCone* zc = (gfan::ZCone*)
v->Data();
384 res->data = (
void*) (
long)
b;
385 gfan::deinitializeCddlibIfRequired();
389 WerrorS(
"isCompatible: unexpected parameters");
401 gfan::initializeCddlibIfRequired();
402 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
403 gfan::ZCone* zc = (gfan::ZCone*)
v->Data();
409 n = (int)(
long)
w->Data();
415 WerrorS(
"insertCone: cone and fan not compatible");
416 gfan::deinitializeCddlibIfRequired();
425 gfan::deinitializeCddlibIfRequired();
429 WerrorS(
"insertCone: unexpected parameters");
435 gfan::ZVector zv=zc->getRelativeInteriorPoint();
436 for (
int d=0; d<=zf->getAmbientDimension(); d++)
438 for (
int i=0;
i<zf->numberOfConesOfDimension(d,0,1);
i++)
440 gfan::ZCone zd = zf->getCone(d,
i,0,1);
442 if (zd.containsRelatively(zv))
444 gfan::ZCone temp = *zc;
446 return (!(zd != temp));
461 gfan::initializeCddlibIfRequired();
462 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
463 gfan::ZCone* zc = (gfan::ZCone*)
v->Data();
464 if((zf->getAmbientDimension() == zc->ambientDimension()))
468 gfan::deinitializeCddlibIfRequired();
471 gfan::deinitializeCddlibIfRequired();
472 WerrorS(
"containsInCollection: mismatching ambient dimensions");
476 WerrorS(
"containsInCollection: unexpected parameters");
522 gfan::initializeCddlibIfRequired();
523 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
524 gfan::ZCone* zc = (gfan::ZCone*)
v->Data();
535 WerrorS(
"removeCone: cone not contained in fan");
536 gfan::deinitializeCddlibIfRequired();
545 gfan::deinitializeCddlibIfRequired();
549 WerrorS(
"removeCone: unexpected parameters");
564 gfan::initializeCddlibIfRequired();
565 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
567 int d = (int)(
long)
v->Data();
568 d -= zf->getLinealityDimension();
570 int i = (int)(
long)
w->Data();
576 WerrorS(
"getCone: invalid maximality flag");
577 gfan::deinitializeCddlibIfRequired();
581 m = (int)(
long)
x->Data();
584 if (d<0 || (d>zf->getAmbientDimension()-zf->getLinealityDimension()))
586 WerrorS(
"getCone: invalid dimension");
587 gfan::deinitializeCddlibIfRequired();
590 if (i<0 || i>=zf->numberOfConesOfDimension(d,0,mm))
592 WerrorS(
"getCone: invalid index");
593 gfan::deinitializeCddlibIfRequired();
597 gfan::ZCone zc = zf->getCone(d,
i,0,mm);
599 res->data = (
void*)
new gfan::ZCone(zc);
600 gfan::deinitializeCddlibIfRequired();
605 WerrorS(
"getCone: unexpected parameters");
617 gfan::initializeCddlibIfRequired();
618 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
619 int d = (int)(
long)
v->Data();
625 o = (int)(
long)
w->Data();
629 m = (int)(
long)
x->Data();
634 if (((o == 0) || (o == 1)) && ((
m == 0) || (
m == 1)))
640 int ld = zf->getLinealityDimension();
644 int n = zf->numberOfConesOfDimension(d-ld,oo,mm);
646 for (
int i=0;
i<n;
i++)
648 gfan::ZCone zc = zf->getCone(d-ld,
i,oo,mm);
652 res->data = (
void*) L;
653 gfan::deinitializeCddlibIfRequired();
658 WerrorS(
"getCones: invalid dimension; no cones in this dimension");
659 gfan::deinitializeCddlibIfRequired();
665 WerrorS(
"getCones: invalid dimension");
666 gfan::deinitializeCddlibIfRequired();
672 WerrorS(
"getCones: invalid specifier for orbit or maximal");
673 gfan::deinitializeCddlibIfRequired();
678 WerrorS(
"getCones: unexpected parameters");
684 int i = zf->isSimplicial() ? 1 : 0;
693 gfan::initializeCddlibIfRequired();
694 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
695 int b = zf->isPure();
697 res->data = (
void*) (
long)
b;
698 gfan::deinitializeCddlibIfRequired();
701 WerrorS(
"isPure: unexpected parameters");
725 gfan::initializeCddlibIfRequired();
726 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
727 gfan::ZVector zv=zf->getFVector();
730 gfan::deinitializeCddlibIfRequired();
733 WerrorS(
"fVector: unexpected parameters");
737gfan::ZMatrix
rays(
const gfan::ZFan*
const zf)
739 gfan::ZMatrix
rays(0,zf->getAmbientDimension());
740 for (
int i=0;
i<zf->numberOfConesOfDimension(1,0,0);
i++)
742 gfan::ZCone zc = zf->getCone(1,
i, 0, 0);
743 rays.append(zc.extremeRays());
751 int ambientDim = zf->getAmbientDimension();
752 for (
int i=0;
i<zf->numberOfConesOfDimension(ambientDim, 0, 0);
i++)
754 gfan::ZCone zc = zf->getCone(ambientDim,
i, 0, 0);
773 gfan::initializeCddlibIfRequired();
774 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
776 int ambientDim = zf->getAmbientDimension();
777 if (ambientDim != v0->
cols())
779 WerrorS(
"numberOfConesWithVector: mismatching dimensions");
780 gfan::deinitializeCddlibIfRequired();
788 gfan::deinitializeCddlibIfRequired();
792 WerrorS(
"numberOfConesWithVector: unexpected parameters");
801 gfan::initializeCddlibIfRequired();
802 std::string fanInString = (
char*) u->
Data();
803 std::istringstream
s(fanInString);
804 gfan::ZFan* zf =
new gfan::ZFan(
s);
806 res->data = (
void*) zf;
807 gfan::deinitializeCddlibIfRequired();
810 WerrorS(
"fanFromString: unexpected parameters");
822 gfan::initializeCddlibIfRequired();
825 WerrorS(
"fanViaCones: list contains entries of wrong type");
828 gfan::ZCone* zc = (gfan::ZCone*) L->
m[0].
Data();
829 gfan::ZFan* zf =
new gfan::ZFan(zc->ambientDimension());
835 WerrorS(
"fanViaCones: entries of wrong type in list");
836 gfan::deinitializeCddlibIfRequired();
839 gfan::ZCone* zc = (gfan::ZCone*) L->
m[
i].
Data();
840 if (zc->ambientDimension() != zf->getAmbientDimension())
842 WerrorS(
"fanViaCones: inconsistent ambient dimensions amongst cones in list");
843 gfan::deinitializeCddlibIfRequired();
849 res->data = (
void*) zf;
850 gfan::deinitializeCddlibIfRequired();
854 res->data = (
void*)
new gfan::ZFan(0);
859 gfan::initializeCddlibIfRequired();
860 gfan::ZCone* zc = (gfan::ZCone*) u->
Data();
861 gfan::ZFan* zf =
new gfan::ZFan(zc->ambientDimension());
868 WerrorS(
"fanViaCones: arguments of wrong type");
869 gfan::deinitializeCddlibIfRequired();
873 gfan::ZCone* zc = (gfan::ZCone*) u->
Data();
874 if (zc->ambientDimension() != zf->getAmbientDimension())
876 WerrorS(
"fanViaCones: inconsistent ambient dimensions amongst input cones");
877 gfan::deinitializeCddlibIfRequired();
884 res->data = (
void*) zf;
885 gfan::deinitializeCddlibIfRequired();
891 res->data = (
void*)
new gfan::ZFan(0);
894 WerrorS(
"fanViaCones: unexpected parameters");
950 assume(zf.getAmbientDimension() == zg.getAmbientDimension());
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));
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));
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));
982 gfan::initializeCddlibIfRequired();
983 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
984 gfan::ZFan* zg = (gfan::ZFan*)
v->Data();
987 res->data = (
void*) zr;
988 gfan::deinitializeCddlibIfRequired();
992 WerrorS(
"commonRefinement: unexpected parameters");
1049 memset(&
l,0,
sizeof(
l));
1051 l.data=(
void*)
"fan";
1054 gfan::ZFan* zf = (gfan::ZFan*) d;
1055 std::string
s = zf->toString(2+4+8+128);
1057 fprintf(dd->
f_write,
"%d %s ",(
int)
s.size(),
s.c_str());
1073 std::istringstream fanInString(std::string(
buf,
l));
1074 gfan::ZFan* zf =
new gfan::ZFan(fanInString);
1084 blackbox *
b=(blackbox*)
omAlloc0(
sizeof(blackbox));
BOOLEAN nmaxcones(leftv res, leftv args)
int getDimension(gfan::ZFan *zf)
BOOLEAN numberOfConesOfDimension(leftv res, leftv args)
BOOLEAN emptyFan(leftv res, leftv args)
BOOLEAN fanViaCones(leftv res, leftv args)
bool containsInCollection(gfan::ZFan *zf, gfan::ZCone *zc)
BOOLEAN fullFan(leftv res, leftv args)
static BOOLEAN jjFANFULL_I(leftv res, leftv v)
BOOLEAN getCones(leftv res, leftv args)
char * bbfan_String(blackbox *, void *d)
BOOLEAN fanFromString(leftv res, leftv args)
BOOLEAN isPure(leftv res, leftv args)
void * bbfan_Copy(blackbox *, void *d)
int numberOfConesWithVector(gfan::ZFan *zf, gfan::ZVector *v)
BOOLEAN ncones(leftv res, leftv args)
BOOLEAN bbfan_deserialize(blackbox **b, void **d, si_link f)
int isSimplicial(gfan::ZFan *zf)
static BOOLEAN jjFANEMPTY_I(leftv res, leftv v)
BOOLEAN removeCone(leftv res, leftv args)
int getCodimension(gfan::ZFan *zf)
void bbfan_destroy(blackbox *, void *d)
gfan::ZFan commonRefinement(gfan::ZFan zf, gfan::ZFan zg)
void * bbfan_Init(blackbox *)
BOOLEAN getCone(leftv res, leftv args)
BOOLEAN bbfan_Assign(leftv l, leftv r)
void bbfan_setup(SModulFunctions *p)
static BOOLEAN jjFANFULL_IM(leftv res, leftv v)
BOOLEAN bbfan_serialize(blackbox *b, void *d, si_link f)
gfan::ZMatrix rays(const gfan::ZFan *const zf)
static BOOLEAN jjFANEMPTY_IM(leftv res, leftv v)
int getLinealityDimension(gfan::ZFan *zf)
bool isCompatible(const gfan::ZFan *zf, const gfan::ZCone *zc)
BOOLEAN insertCone(leftv res, leftv args)
static gfan::IntMatrix permutationIntMatrix(const bigintmat *iv)
int getAmbientDimension(gfan::ZFan *zf)
BOOLEAN fVector(leftv res, leftv args)
int setBlackboxStuff(blackbox *bb, const char *n)
define a new type
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
gfan::ZVector * bigintmatToZVector(const bigintmat &bim)
Class used for (list of) interpreter objects.
INLINE_THIS void Init(int l=0)
Coefficient rings, fields and other domains suitable for Singular polynomials.
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
const CanonicalForm int s
const Variable & v
< [in] a sqrfree bivariate poly
void WerrorS(const char *s)
intvec * ivCopy(const intvec *o)
#define IMATELEM(M, I, J)
void Werror(const char *fmt,...)
int s_readbytes(char *buff, int len, s_buff F)
int status int void size_t count
int status int void * buf