22 return (
void*)
new gfan::ZFan(0);
29 gfan::ZFan* zf = (gfan::ZFan*) d;
39 gfan::ZFan* zf = (gfan::ZFan*)d;
63 gfan::ZFan* zf = (gfan::ZFan*)d;
64 gfan::ZFan* newZf =
new gfan::ZFan(*zf);
75 gfan::ZFan* zd = (gfan::ZFan*) l->
Data();
78 newZf =
new gfan::ZFan(0);
80 else if (r->
Typ()==l->
Typ())
84 gfan::ZFan* zd = (gfan::ZFan*) l->
Data();
87 newZf = (gfan::ZFan*) r->
CopyD();
91 int ambientDim = (int) (
long) r->
Data();
94 Werror(
"expected an int >= 0, but got %d", ambientDim);
99 gfan::ZFan* zd = (gfan::ZFan*) l->
Data();
102 newZf =
new gfan::ZFan(ambientDim);
106 Werror(
"assign Type(%d) = Type(%d) not implemented",l->
Typ(),r->
Typ());
116 l->
data = (
void*) newZf;
130 for (
int r = 1;
r <= rr;
r++)
131 for (
int c = 1; c <= cc; c++)
134 ivCopy->
set(
r,c,temp2);
139 gfan::IntMatrix im = gfan::IntMatrix(gfan::ZToIntMatrix(*zm));
145 int ambientDim = (int)(
long)v->
Data();
148 Werror(
"expected non-negative ambient dim but got %d", ambientDim);
152 res->
data = (
void*)(
new gfan::ZFan(ambientDim));
159 int ambientDim = permutations->
cols();
161 if (!gfan::Permutation::arePermutations(im))
163 Werror(
"provided bigintmat contains invalid permutations of {1, ..., %d}", ambientDim);
166 gfan::SymmetryGroup sg = gfan::SymmetryGroup(ambientDim);
167 sg.computeClosure(im);
169 res->
data = (
void*)(
new gfan::ZFan(sg));
179 res->
data = (
void*)
new gfan::ZFan(0);
190 WerrorS(
"emptyFan: unexpected parameters");
196 int ambientDim = (int)(
long)v->
Data();
199 Werror(
"expected non-negative ambient dim but got %d", ambientDim);
204 res->
data = (
void*) zf;
210 int ambientDim = permutations->
cols();
212 if (!gfan::Permutation::arePermutations(im))
214 Werror(
"provided bigintmat contains invalid permutations of {1, ..., %d}", ambientDim);
217 gfan::SymmetryGroup sg = gfan::SymmetryGroup(ambientDim);
218 sg.computeClosure(im);
221 res->
data = (
void*) zf;
231 res->
data = (
void*)
new gfan::ZFan(0);
238 WerrorS(
"fullFan: unexpected parameters");
244 return zf->getAmbientDimension();
249 return zf->getCodimension();
254 return zf->getDimension();
259 return zf->getLinealityDimension();
276 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
277 int d = (int)(
long)v->
Data();
278 int o = (int)(
long)w->
Data();
279 int m = (int)(
long)x->
Data();
281 && ((o == 0) || (o == 1))
282 && ((m == 0) || (m == 1)))
286 int ld = zf->getLinealityDimension();
289 int n = zf->numberOfConesOfDimension(d-ld,oo,mm);
291 res->
data = (
void*) (
long) n;
295 res->
data = (
void*) (
long) 0;
302 WerrorS(
"numberOfConesOfDimension: unexpected parameters");
311 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
312 int d = zf->getAmbientDimension();
315 for (
int i=0;
i<=d;
i++)
316 n = n + zf->numberOfConesOfDimension(
i,0,0);
319 res->
data = (
void*) (
long) n;
322 WerrorS(
"ncones: unexpected parameters");
331 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
334 for (
int d=0; d<=zf->getAmbientDimension(); d++)
335 n = n + zf->numberOfConesOfDimension(d,0,1);
338 res->
data = (
void*) (
long) n;
341 WerrorS(
"nmaxcones: unexpected parameters");
347 bool b = (zf->getAmbientDimension() == zc->ambientDimension());
350 for (
int d=0; d<=zf->getAmbientDimension(); d++)
352 for (
int i=0;
i<zf->numberOfConesOfDimension(d,0,1);
i++)
354 gfan::ZCone zd = zf->getCone(d,
i,0,1);
355 gfan::ZCone zt = gfan::intersection(*zc,zd);
357 b = b && zd.hasFace(zt);
372 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
373 gfan::ZCone* zc = (gfan::ZCone*)v->
Data();
376 res->
data = (
void*) (
long)
b;
380 WerrorS(
"isCompatible: unexpected parameters");
392 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
393 gfan::ZCone* zc = (gfan::ZCone*)v->
Data();
405 WerrorS(
"insertCone: cone and fan not compatible");
417 WerrorS(
"insertCone: unexpected parameters");
423 gfan::ZVector zv=zc->getRelativeInteriorPoint();
424 for (
int d=0; d<=zf->getAmbientDimension(); d++)
426 for (
int i=0;
i<zf->numberOfConesOfDimension(d,0,1);
i++)
428 gfan::ZCone zd = zf->getCone(d,
i,0,1);
430 if (zd.containsRelatively(zv))
432 gfan::ZCone temp = *zc;
434 return (!(zd != temp));
449 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
450 gfan::ZCone* zc = (gfan::ZCone*)v->
Data();
451 if((zf->getAmbientDimension() == zc->ambientDimension()))
457 WerrorS(
"containsInCollection: mismatching ambient dimensions");
461 WerrorS(
"containsInCollection: unexpected parameters");
507 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
508 gfan::ZCone* zc = (gfan::ZCone*)v->
Data();
519 WerrorS(
"removeCone: cone not contained in fan");
531 WerrorS(
"removeCone: unexpected parameters");
546 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
547 int d = (int)(
long)v->
Data();
548 int i = (int)(
long)w->
Data();
554 o = (int)(
long)x->
Data();
558 m = (int)(
long)y->
Data();
563 if (((o == 0) || (o == 1)) && ((m == 0) || (m == 1)))
569 int ld = zf->getLinealityDimension();
575 gfan::ZCone zc = zf->getCone(d-ld,i,oo,mm);
577 res->
data = (
void*)
new gfan::ZCone(zc);
582 WerrorS(
"getCone: invalid dimension; no cones in this dimension");
588 WerrorS(
"getCone: invalid index");
594 WerrorS(
"getCone: invalid dimension");
600 WerrorS(
"getCone: invalid specifier for orbit or maximal");
606 WerrorS(
"getCone: unexpected parameters");
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;
657 WerrorS(
"getCones: invalid dimension; no cones in this dimension");
663 WerrorS(
"getCones: invalid dimension");
669 WerrorS(
"getCones: invalid specifier for orbit or maximal");
674 WerrorS(
"getCones: unexpected parameters");
680 int i = zf->isSimplicial() ? 1 : 0;
689 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
690 int b = zf->isPure();
692 res->
data = (
void*) (
long)
b;
695 WerrorS(
"isPure: unexpected parameters");
719 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
720 gfan::ZVector zv=zf->getFVector();
725 WerrorS(
"fVector: unexpected parameters");
729 gfan::ZMatrix
rays(
const gfan::ZFan*
const zf)
731 gfan::ZMatrix
rays(0,zf->getAmbientDimension());
732 for (
int i=0;
i<zf->numberOfConesOfDimension(1,0,0);
i++)
734 gfan::ZCone zc = zf->getCone(1,
i, 0, 0);
735 rays.append(zc.extremeRays());
743 int ambientDim = zf->getAmbientDimension();
744 for (
int i=0;
i<zf->numberOfConesOfDimension(ambientDim, 0, 0);
i++)
746 gfan::ZCone zc = zf->getCone(ambientDim,
i, 0, 0);
765 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
767 int ambientDim = zf->getAmbientDimension();
768 if (ambientDim != v0->
cols())
770 WerrorS(
"numberOfConesWithVector: mismatching dimensions");
781 WerrorS(
"numberOfConesWithVector: unexpected parameters");
791 std::istringstream
s(fanInString);
792 gfan::ZFan* zf =
new gfan::ZFan(s);
794 res->
data = (
void*) zf;
797 WerrorS(
"fanFromString: unexpected parameters");
811 WerrorS(
"fanViaCones: list contains entries of wrong type");
814 gfan::ZCone* zc = (gfan::ZCone*) L->
m[0].
Data();
815 gfan::ZFan* zf =
new gfan::ZFan(zc->ambientDimension());
821 WerrorS(
"fanViaCones: entries of wrong type in list");
824 gfan::ZCone* zc = (gfan::ZCone*) L->
m[
i].
Data();
825 if (zc->ambientDimension() != zf->getAmbientDimension())
827 WerrorS(
"fanViaCones: inconsistent ambient dimensions amongst cones in list");
833 res->
data = (
void*) zf;
837 res->
data = (
void*)
new gfan::ZFan(0);
842 gfan::ZCone* zc = (gfan::ZCone*) u->
Data();
843 gfan::ZFan* zf =
new gfan::ZFan(zc->ambientDimension());
850 WerrorS(
"fanViaCones: arguments of wrong type");
853 gfan::ZCone* zc = (gfan::ZCone*) u->
Data();
854 if (zc->ambientDimension() != zf->getAmbientDimension())
856 WerrorS(
"fanViaCones: inconsistent ambient dimensions amongst input cones");
862 res->
data = (
void*) zf;
868 res->
data = (
void*)
new gfan::ZFan(0);
871 WerrorS(
"fanViaCones: unexpected parameters");
927 assume(zf.getAmbientDimension() == zg.getAmbientDimension());
930 std::list<gfan::ZCone> maximalConesOfF;
931 for (
int d=0; d<=zf.getAmbientDimension(); d++)
932 for (
int i=0;
i<zf.numberOfConesOfDimension(d,0,1);
i++)
933 maximalConesOfF.push_back(zf.getCone(d,
i,0,1));
935 std::list<gfan::ZCone> maximalConesOfG;
936 for (
int d=0; d<=zg.getAmbientDimension(); d++)
937 for (
int i=0;
i<zg.numberOfConesOfDimension(d,0,1);
i++)
938 maximalConesOfG.push_back(zg.getCone(d,
i,0,1));
941 gfan::ZFan zr = gfan::ZFan(zf.getAmbientDimension());
942 for (std::list<gfan::ZCone>::iterator itf=maximalConesOfF.begin();
943 itf != maximalConesOfF.end(); itf++)
944 for (std::list<gfan::ZCone>::iterator itg=maximalConesOfG.begin();
945 itg != maximalConesOfG.end(); itg++)
946 zr.insert(intersection(*itf,*itg));
959 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
960 gfan::ZFan* zg = (gfan::ZFan*) v->
Data();
963 res->
data = (
void*) zr;
967 WerrorS(
"commonRefinement: unexpected parameters");
1021 blackbox *
b=(blackbox*)
omAlloc0(
sizeof(blackbox));
int status int void size_t count
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
char * bbfan_String(blackbox *, void *d)
const CanonicalForm int s
const CanonicalForm int const CFList const Variable & y
Class used for (list of) interpreter objects.
BOOLEAN numberOfConesOfDimension(leftv res, leftv args)
BOOLEAN nmaxcones(leftv res, leftv args)
bool isCompatible(const gfan::ZFan *zf, const gfan::ZCone *zc)
void * bbfan_Init(blackbox *)
BOOLEAN fullFan(leftv res, leftv args)
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
void bbfan_setup(SModulFunctions *p)
intvec * ivCopy(const intvec *o)
BOOLEAN bbfan_Assign(leftv l, leftv r)
BOOLEAN emptyFan(leftv res, leftv args)
void WerrorS(const char *s)
static BOOLEAN jjFANEMPTY_IM(leftv res, leftv v)
BOOLEAN fanViaCones(leftv res, leftv args)
bigintmat * zVectorToBigintmat(const gfan::ZVector &zv)
int getAmbientDimension(gfan::ZFan *zf)
void set(int i, int j, number n, const coeffs C=NULL)
replace an entry with a copy (delete old + copy new!). NOTE: starts at [1,1]
void * bbfan_Copy(blackbox *, void *d)
Coefficient rings, fields and other domains suitable for Singular polynomials.
int isSimplicial(gfan::ZFan *zf)
BOOLEAN getCone(leftv res, leftv args)
BOOLEAN fanFromString(leftv res, leftv args)
gfan::ZMatrix rays(const gfan::ZFan *const zf)
BOOLEAN ncones(leftv res, leftv args)
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
int numberOfConesWithVector(gfan::ZFan *zf, gfan::ZVector *v)
BOOLEAN insertCone(leftv res, leftv args)
BOOLEAN fVector(leftv res, leftv args)
static BOOLEAN jjFANEMPTY_I(leftv res, leftv v)
bool containsInCollection(gfan::ZFan *zf, gfan::ZCone *zc)
int getCodimension(gfan::ZFan *zf)
BOOLEAN getCones(leftv res, leftv args)
INLINE_THIS void Init(int l=0)
const Variable & v
< [in] a sqrfree bivariate poly
BOOLEAN isPure(leftv res, leftv args)
static gfan::IntMatrix permutationIntMatrix(const bigintmat *iv)
gfan::ZFan commonRefinement(gfan::ZFan zf, gfan::ZFan zg)
int getLinealityDimension(gfan::ZFan *zf)
int getDimension(gfan::ZFan *zf)
BOOLEAN removeCone(leftv res, leftv args)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
int(* iiAddCproc)(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
static BOOLEAN jjFANFULL_IM(leftv res, leftv v)
int setBlackboxStuff(blackbox *bb, const char *n)
define a new type
#define IMATELEM(M, I, J)
void bbfan_destroy(blackbox *, void *d)
static BOOLEAN jjFANFULL_I(leftv res, leftv v)
void Werror(const char *fmt,...)
gfan::ZVector * bigintmatToZVector(const bigintmat &bim)