30 interiorPoint(gfan::ZVector()),
31 facetNormal(gfan::ZVector())
37 interiorPoint(
f.interiorPoint),
38 facetNormal(
f.facetNormal)
41 gfan::ZCone c =
f.eta;
42 gfan::ZVector
v =
f.interiorPoint;
43 gfan::ZVector
w =
f.facetNormal;
44 assume(c.ambientDimension() == (
int)
v.size());
45 assume(c.ambientDimension() == (
int)
w.size());
51 facet::facet(
const gfan::ZCone &c,
const gfan::ZVector &
v,
const gfan::ZVector &
w):
57 assume(c.ambientDimension() == (
int)
v.size());
58 assume(c.ambientDimension() == (
int)
w.size());
67 gfan::ZCone c = this->
eta;
70 assume(c.ambientDimension() == (
int)
v.size());
71 assume(c.ambientDimension() == (
int)
w.size());
79 std::pair<facets::iterator,bool>
check(newFacets.begin(),
false);
80 for(facets::iterator
p=newFacets.begin();
p!=newFacets.end();
p++)
91 static gfan::ZCone
subcone(
const lists &cones,
const gfan::ZVector &point)
93 gfan::ZCone sigma = gfan::ZCone(gfan::ZMatrix(1,point.size()), gfan::ZMatrix(1,point.size()));
95 for (
int i=0;
i<=cones->
nr;
i++)
97 zc = (gfan::ZCone*) cones->
m[
i].
Data();
98 if (zc->contains(point))
99 sigma = gfan::intersection(sigma,*zc);
107 gfan::ZMatrix
equations = zc.getImpliedEquations();
121 gfan::ZMatrix newInequalities =
inequalities.submatrix(1,0,r,c);
124 gfan::ZCone eta = gfan::ZCone(newInequalities,newEquations);
126 gfan::ZVector
v = eta.getRelativeInteriorPoint();
129 if (
bound.containsRelatively(
v))
133 for (
int i=1;
i<r-1;
i++)
139 eta = gfan::ZCone(newInequalities,newEquations);
141 v = eta.getRelativeInteriorPoint();
143 if (
bound.containsRelatively(
v))
151 eta = gfan::ZCone(newInequalities,newEquations);
154 v = eta.getRelativeInteriorPoint();
156 if (
bound.containsRelatively(
v))
173 gfan::ZCone
support = gfan::ZCone::givenByRays(*zm, gfan::ZMatrix(0, zm->getWidth()));
184 gfan::ZCone
lambda; gfan::ZVector point;
191 int iterationNumber = 1;
192 std::cout <<
"cones found: " << iterationNumber++ << std::endl;
195 gfan::ZFan* Sigma =
new gfan::ZFan(
lambda.ambientDimension());
201 res->data = (
void*) Sigma;
208 gfan::ZVector interiorPoint;
209 gfan::ZVector facetNormal;
218 interiorPoint =
f.getInteriorPoint();
219 facetNormal =
f.getFacetNormal();
226 point =
mu * interiorPoint - facetNormal;
227 while (!
support.containsRelatively(point))
230 point =
mu * interiorPoint - facetNormal;
234 while ((
lambda.dimension() <
lambda.ambientDimension()) && !(
lambda.contains(interiorPoint)))
237 point =
mu * interiorPoint - facetNormal;
240 std::cout <<
"cones found: " << iterationNumber++ << std::endl;
253 res->data = (
void*) Sigma;
257 WerrorS(
"refineCones: unexpected parameters");
266 gfan::Integer
num = 1;
267 gfan::Integer
den = 1;
268 for (
int i=1;
i<=
k;
i++)
270 for (
int j=n-
k+1;
j<=n;
j++)
272 gfan::Integer bin =
num/
den;
281 for (
int i=0;
i<n;
i++)
298 int n = (int)(
long) u->
Data();
299 int k = (int)(
long)
v->Data();
301 for (
int i=0;
i<
k;
i++)
307 while (!(
v & (1<<n)))
316 v = (t + 1) | (((~t & -~t) - 1) >> (__builtin_ctz(
v) + 1));
319 res->data = (
void*) L;
323 WerrorS(
"listOfAfacesToCheck: unexpected parameter");
345 af |= 1<<((*aface)[
i]-1);
347 unsigned int t = af | (af - 1);
348 af = (t + 1) | (((~t & -~t) - 1) >> (__builtin_ctz(af) + 1));
363 WerrorS(
"nextAfaceToCheck: unexpected parameter");
390 res->data = (
void*) (
long) 0;
400 res->data = (
void*) (
long) 0;
406 res->data = (
void*) (
long) 1;
408 delete interiorPoint;
412 WerrorS(
"checkSigns: unexpected parameter");
427 for (
int i=1;
i<
l;
i++)
429 number endResultCache;
435 endResult = endResultCache;
436 endResultCache =
NULL;
440 res->data = (
void*) endResult;
443 WerrorS(
"binaryToBigint: unexpected parameter");
460 for (
int i=0;
i<
k;
i++)
461 (*composedIntvec)[
i] = (*iv1)[(*iv2)[
i]-1];
463 res->data = (
void*) composedIntvec;
467 WerrorS(
"composeIntvecs: unexpected parameter");
481 number numberToInsert = (number)
v->Data();
483 int upperBound =
lSize(listOfNumbers);
487 res->data = (
void*) (
long) (lowerBound+1);
491 number lowerNumber = (number) listOfNumbers->
m[lowerBound].
Data();
495 res->data = (
void*) (
long) (-1);
501 res->data = (
void*) (
long) (lowerBound+1);
505 number upperNumber = (number) listOfNumbers->
m[upperBound].
Data();
509 res->data = (
void*) (
long) (-1);
515 res->data = (
void*) (
long) (upperBound+2);
519 while (lowerBound+1<upperBound)
521 int middle = lowerBound + (upperBound-lowerBound) / 2;
522 number lowerNumber = (number) listOfNumbers->
m[lowerBound].
Data();
523 number upperNumber = (number) listOfNumbers->
m[upperBound].
Data();
524 number middleNumber = (number) listOfNumbers->
m[middle].
Data();
530 res->data = (
void*) (
long) -1;
540 res->data = (
void*) (
long) (upperBound+1);
544 WerrorS(
"findPlaceToInsert: unexpected parameter");
551 gfan::initializeCddlibIfRequired();
BOOLEAN ambientDimension(leftv res, leftv args)
BOOLEAN equations(leftv res, leftv args)
BOOLEAN dimension(leftv res, leftv args)
gfan::ZVector randomPoint(const gfan::ZCone *zc, const int b)
BOOLEAN inequalities(leftv res, leftv args)
bigintmat * iv2bim(intvec *b, const coeffs C)
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
void lambda(int **points, int sizePoints)
void mu(int **points, int sizePoints)
static CanonicalForm bound(const CFMatrix &M)
coeffs basecoeffs() const
gfan::ZVector facetNormal
gfan::ZVector interiorPoint
Class used for (list of) interpreter objects.
INLINE_THIS void Init(int l=0)
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of 'a' and 'b', i.e., a+b
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff 'a' is larger than 'b'; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
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
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
static BOOLEAN support(leftv res, leftv args)
const Variable & v
< [in] a sqrfree bivariate poly
void WerrorS(const char *s)
static int binomial(int n, int k)
static gitfan::facets interiorFacets(const gfan::ZCone &zc, const gfan::ZCone &bound)
BOOLEAN listOfAfacesToCheck(leftv res, leftv args)
BOOLEAN findPlaceToInsert(leftv res, leftv args)
BOOLEAN checkSigns(leftv res, leftv args)
BOOLEAN refineCones(leftv res, leftv args)
BOOLEAN binaryToBigint(leftv res, leftv args)
static gfan::ZCone subcone(const lists &cones, const gfan::ZVector &point)
BOOLEAN nextAfaceToCheck(leftv res, leftv args)
intvec * intToAface(unsigned int v0, int n, int k)
BOOLEAN composeIntvecs(leftv res, leftv args)
void mergeFacets(facets &F, const facets &newFacets)
std::set< facet, facet_compare > facets
int status int void size_t count