24 return (
void*)
new gfan::ZFan(0);
31 gfan::ZFan* zf = (gfan::ZFan*) d;
41 gfan::ZFan* zf = (gfan::ZFan*)d;
65 gfan::ZFan* zf = (gfan::ZFan*)d;
66 gfan::ZFan* newZf =
new gfan::ZFan(*zf);
77 gfan::ZFan* zd = (gfan::ZFan*) l->
Data();
80 newZf =
new gfan::ZFan(0);
82 else if (r->
Typ()==l->
Typ())
86 gfan::ZFan* zd = (gfan::ZFan*) l->
Data();
89 newZf = (gfan::ZFan*) r->
CopyD();
93 int ambientDim = (int) (
long) r->
Data();
96 Werror(
"expected an int >= 0, but got %d", ambientDim);
101 gfan::ZFan* zd = (gfan::ZFan*) l->
Data();
104 newZf =
new gfan::ZFan(ambientDim);
108 Werror(
"assign Type(%d) = Type(%d) not implemented",l->
Typ(),r->
Typ());
118 l->
data = (
void*) newZf;
132 for (
int r = 1;
r <= rr;
r++)
133 for (
int c = 1; c <= cc; c++)
136 ivCopy->
set(
r,c,temp2);
141 gfan::IntMatrix im = gfan::IntMatrix(gfan::ZToIntMatrix(*zm));
147 int ambientDim = (int)(
long)v->
Data();
150 Werror(
"expected non-negative ambient dim but got %d", ambientDim);
154 res->
data = (
void*)(
new gfan::ZFan(ambientDim));
161 int ambientDim = permutations->
cols();
163 if (!gfan::Permutation::arePermutations(im))
165 Werror(
"provided bigintmat contains invalid permutations of {1, ..., %d}", ambientDim);
168 gfan::SymmetryGroup sg = gfan::SymmetryGroup(ambientDim);
169 sg.computeClosure(im);
171 res->
data = (
void*)(
new gfan::ZFan(sg));
181 res->
data = (
void*)
new gfan::ZFan(0);
192 WerrorS(
"emptyFan: unexpected parameters");
198 int ambientDim = (int)(
long)v->
Data();
201 Werror(
"expected non-negative ambient dim but got %d", ambientDim);
206 res->
data = (
void*) zf;
212 int ambientDim = permutations->
cols();
214 if (!gfan::Permutation::arePermutations(im))
216 Werror(
"provided bigintmat contains invalid permutations of {1, ..., %d}", ambientDim);
219 gfan::SymmetryGroup sg = gfan::SymmetryGroup(ambientDim);
220 sg.computeClosure(im);
223 res->
data = (
void*) zf;
233 res->
data = (
void*)
new gfan::ZFan(0);
240 WerrorS(
"fullFan: unexpected parameters");
246 return zf->getAmbientDimension();
251 return zf->getCodimension();
256 return zf->getDimension();
261 return zf->getLinealityDimension();
278 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
279 int d = (int)(
long)v->
Data();
280 int o = (int)(
long)w->
Data();
281 int m = (int)(
long)x->
Data();
283 && ((o == 0) || (o == 1))
284 && ((m == 0) || (m == 1)))
288 int ld = zf->getLinealityDimension();
291 int n = zf->numberOfConesOfDimension(d-ld,oo,mm);
293 res->
data = (
void*) (
long) n;
297 res->
data = (
void*) (
long) 0;
304 WerrorS(
"numberOfConesOfDimension: unexpected parameters");
313 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
314 int d = zf->getAmbientDimension();
317 for (
int i=0;
i<=d;
i++)
318 n = n + zf->numberOfConesOfDimension(
i,0,0);
321 res->
data = (
void*) (
long) n;
324 WerrorS(
"ncones: unexpected parameters");
333 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
336 for (
int d=0; d<=zf->getAmbientDimension(); d++)
337 n = n + zf->numberOfConesOfDimension(d,0,1);
340 res->
data = (
void*) (
long) n;
343 WerrorS(
"nmaxcones: unexpected parameters");
349 bool b = (zf->getAmbientDimension() == zc->ambientDimension());
352 for (
int d=0; d<=zf->getAmbientDimension(); d++)
354 for (
int i=0;
i<zf->numberOfConesOfDimension(d,0,1);
i++)
356 gfan::ZCone zd = zf->getCone(d,
i,0,1);
357 gfan::ZCone zt = gfan::intersection(*zc,zd);
359 b = b && zd.hasFace(zt);
374 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
375 gfan::ZCone* zc = (gfan::ZCone*)v->
Data();
378 res->
data = (
void*) (
long)
b;
382 WerrorS(
"isCompatible: unexpected parameters");
394 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
395 gfan::ZCone* zc = (gfan::ZCone*)v->
Data();
407 WerrorS(
"insertCone: cone and fan not compatible");
419 WerrorS(
"insertCone: unexpected parameters");
425 gfan::ZVector zv=zc->getRelativeInteriorPoint();
426 for (
int d=0; d<=zf->getAmbientDimension(); d++)
428 for (
int i=0;
i<zf->numberOfConesOfDimension(d,0,1);
i++)
430 gfan::ZCone zd = zf->getCone(d,
i,0,1);
432 if (zd.containsRelatively(zv))
434 gfan::ZCone temp = *zc;
436 return (!(zd != temp));
451 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
452 gfan::ZCone* zc = (gfan::ZCone*)v->
Data();
453 if((zf->getAmbientDimension() == zc->ambientDimension()))
459 WerrorS(
"containsInCollection: mismatching ambient dimensions");
463 WerrorS(
"containsInCollection: unexpected parameters");
509 gfan::ZFan* zf = (gfan::ZFan*)u->
Data();
510 gfan::ZCone* zc = (gfan::ZCone*)v->
Data();
521 WerrorS(
"removeCone: cone not contained in fan");
533 WerrorS(
"removeCone: unexpected parameters");
548 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
549 int d = (int)(
long)v->
Data();
550 int i = (int)(
long)w->
Data();
556 o = (int)(
long)x->
Data();
560 m = (int)(
long)y->
Data();
565 if (((o == 0) || (o == 1)) && ((m == 0) || (m == 1)))
571 int ld = zf->getLinealityDimension();
577 gfan::ZCone zc = zf->getCone(d-ld,i,oo,mm);
579 res->
data = (
void*)
new gfan::ZCone(zc);
584 WerrorS(
"getCone: invalid dimension; no cones in this dimension");
590 WerrorS(
"getCone: invalid index");
596 WerrorS(
"getCone: invalid dimension");
602 WerrorS(
"getCone: invalid specifier for orbit or maximal");
608 WerrorS(
"getCone: unexpected parameters");
620 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
621 int d = (int)(
long)v->
Data();
627 o = (int)(
long)w->
Data();
631 m = (int)(
long)x->
Data();
636 if (((o == 0) || (o == 1)) && ((m == 0) || (m == 1)))
642 int ld = zf->getLinealityDimension();
646 int n = zf->numberOfConesOfDimension(d-ld,oo,mm);
648 for (
int i=0;
i<n;
i++)
650 gfan::ZCone zc = zf->getCone(d-ld,
i,oo,mm);
654 res->
data = (
void*) L;
659 WerrorS(
"getCones: invalid dimension; no cones in this dimension");
665 WerrorS(
"getCones: invalid dimension");
671 WerrorS(
"getCones: invalid specifier for orbit or maximal");
676 WerrorS(
"getCones: unexpected parameters");
682 int i = zf->isSimplicial() ? 1 : 0;
691 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
692 int b = zf->isPure();
694 res->
data = (
void*) (
long)
b;
697 WerrorS(
"isPure: unexpected parameters");
721 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
722 gfan::ZVector zv=zf->getFVector();
727 WerrorS(
"fVector: unexpected parameters");
731 gfan::ZMatrix
rays(
const gfan::ZFan*
const zf)
733 gfan::ZMatrix
rays(0,zf->getAmbientDimension());
734 for (
int i=0;
i<zf->numberOfConesOfDimension(1,0,0);
i++)
736 gfan::ZCone zc = zf->getCone(1,
i, 0, 0);
737 rays.append(zc.extremeRays());
745 int ambientDim = zf->getAmbientDimension();
746 for (
int i=0;
i<zf->numberOfConesOfDimension(ambientDim, 0, 0);
i++)
748 gfan::ZCone zc = zf->getCone(ambientDim,
i, 0, 0);
767 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
769 int ambientDim = zf->getAmbientDimension();
770 if (ambientDim != v0->
cols())
772 WerrorS(
"numberOfConesWithVector: mismatching dimensions");
783 WerrorS(
"numberOfConesWithVector: unexpected parameters");
793 std::istringstream
s(fanInString);
794 gfan::ZFan* zf =
new gfan::ZFan(s);
796 res->
data = (
void*) zf;
799 WerrorS(
"fanFromString: unexpected parameters");
813 WerrorS(
"fanViaCones: list contains entries of wrong type");
816 gfan::ZCone* zc = (gfan::ZCone*) L->
m[0].
Data();
817 gfan::ZFan* zf =
new gfan::ZFan(zc->ambientDimension());
823 WerrorS(
"fanViaCones: entries of wrong type in list");
826 gfan::ZCone* zc = (gfan::ZCone*) L->
m[
i].
Data();
827 if (zc->ambientDimension() != zf->getAmbientDimension())
829 WerrorS(
"fanViaCones: inconsistent ambient dimensions amongst cones in list");
835 res->
data = (
void*) zf;
839 res->
data = (
void*)
new gfan::ZFan(0);
844 gfan::ZCone* zc = (gfan::ZCone*) u->
Data();
845 gfan::ZFan* zf =
new gfan::ZFan(zc->ambientDimension());
852 WerrorS(
"fanViaCones: arguments of wrong type");
855 gfan::ZCone* zc = (gfan::ZCone*) u->
Data();
856 if (zc->ambientDimension() != zf->getAmbientDimension())
858 WerrorS(
"fanViaCones: inconsistent ambient dimensions amongst input cones");
864 res->
data = (
void*) zf;
870 res->
data = (
void*)
new gfan::ZFan(0);
873 WerrorS(
"fanViaCones: unexpected parameters");
929 assume(zf.getAmbientDimension() == zg.getAmbientDimension());
932 std::list<gfan::ZCone> maximalConesOfF;
933 for (
int d=0; d<=zf.getAmbientDimension(); d++)
934 for (
int i=0;
i<zf.numberOfConesOfDimension(d,0,1);
i++)
935 maximalConesOfF.push_back(zf.getCone(d,
i,0,1));
937 std::list<gfan::ZCone> maximalConesOfG;
938 for (
int d=0; d<=zg.getAmbientDimension(); d++)
939 for (
int i=0;
i<zg.numberOfConesOfDimension(d,0,1);
i++)
940 maximalConesOfG.push_back(zg.getCone(d,
i,0,1));
943 gfan::ZFan zr = gfan::ZFan(zf.getAmbientDimension());
944 for (std::list<gfan::ZCone>::iterator itf=maximalConesOfF.begin();
945 itf != maximalConesOfF.end(); itf++)
946 for (std::list<gfan::ZCone>::iterator itg=maximalConesOfG.begin();
947 itg != maximalConesOfG.end(); itg++)
948 zr.insert(intersection(*itf,*itg));
961 gfan::ZFan* zf = (gfan::ZFan*) u->
Data();
962 gfan::ZFan* zg = (gfan::ZFan*) v->
Data();
965 res->
data = (
void*) zr;
969 WerrorS(
"commonRefinement: unexpected parameters");
1026 memset(&
l,0,
sizeof(
l));
1028 l.data=(
void*)
"fan";
1031 gfan::ZFan* zf = (gfan::ZFan*) d;
1034 fprintf(dd->
f_write,
"%d %s ",(
int)s.size(),s.c_str());
1051 gfan::ZFan* zf =
new gfan::ZFan(fanInString);
1061 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)
int s_readbytes(char *buff, int len, s_buff F)
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)
BOOLEAN bbfan_deserialize(blackbox **b, void **d, si_link f)
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 status int void * buf
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'
BOOLEAN bbfan_serialize(blackbox *b, void *d, si_link f)
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)