30 interiorPoint(gfan::ZVector()),
31 facetNormal(gfan::ZVector())
41 gfan::ZCone c = f.
eta;
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();
108 int r = inequalities.getHeight();
109 int c = inequalities.getWidth();
121 gfan::ZMatrix newInequalities = inequalities.submatrix(1,0,r,c);
123 newEquations.appendRow(inequalities[0]);
124 gfan::ZCone
eta = gfan::ZCone(newInequalities,newEquations);
126 gfan::ZVector
v = eta.getRelativeInteriorPoint();
127 gfan::ZVector
w = inequalities[0];
129 if (bound.containsRelatively(v))
133 for (
int i=1;
i<r-1;
i++)
135 newInequalities = inequalities.submatrix(0,0,
i,c);
136 newInequalities.append(inequalities.submatrix(
i+1,0,r,c));
138 newEquations.appendRow(inequalities[
i]);
139 eta = gfan::ZCone(newInequalities,newEquations);
141 v = eta.getRelativeInteriorPoint();
143 if (bound.containsRelatively(v))
148 newInequalities = inequalities.submatrix(0,0,r-1,c);
150 newEquations.appendRow(inequalities[r-1]);
151 eta = gfan::ZCone(newInequalities,newEquations);
154 v = eta.getRelativeInteriorPoint();
155 w = inequalities[r-1];
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;
188 lambda =
subcone(cones, point);
190 while (lambda.dimension() < lambda.ambientDimension());
191 int iterationNumber = 1;
192 std::cout <<
"cones found: " << iterationNumber++ << std::endl;
194 lambda.canonicalize();
195 gfan::ZFan* Sigma =
new gfan::ZFan(lambda.ambientDimension());
196 Sigma->insert(lambda);
201 res->
data = (
void*) Sigma;
227 while (!support.containsRelatively(point))
234 while ((lambda.dimension() < lambda.ambientDimension()) && !(lambda.contains(interiorPoint)))
240 std::cout <<
"cones found: " << iterationNumber++ << std::endl;
246 lambda.canonicalize();
247 Sigma->insert(lambda);
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));
350 if (af & (1<<ambientDimension))
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");
549 void subset(std::vector<int> &arr,
int size,
int left,
int index, std::vector<int> &
l, std::vector<std::vector<int> > &L)
560 subset(arr,size,left-1,i+1,l,L);
567 gfan::initializeCddlibIfRequired();
int status int void size_t count
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 int binomial(int n, int k)
void subset(std::vector< int > &arr, int size, int left, int index, std::vector< int > &l, std::vector< std::vector< int > > &L)
Class used for (list of) interpreter objects.
static CanonicalForm bound(const CFMatrix &M)
void mu(int **points, int sizePoints)
gfan::ZVector randomPoint(const gfan::ZCone *zc, const int b)
bigintmat * iv2bim(intvec *b, const coeffs C)
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
BOOLEAN composeIntvecs(leftv res, leftv args)
gfan::ZVector facetNormal
void WerrorS(const char *s)
BOOLEAN listOfAfacesToCheck(leftv res, leftv args)
BOOLEAN binaryToBigint(leftv res, leftv args)
void mergeFacets(facets &F, const facets &newFacets)
gfan::ZVector getFacetNormal()
BOOLEAN inequalities(leftv res, leftv args)
gfan::ZMatrix * bigintmatToZMatrix(const bigintmat &bim)
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of 'a' and 'b', i.e., a+b
BOOLEAN support(leftv res, leftv args)
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)
std::set< facet, facet_compare > facets
BOOLEAN findPlaceToInsert(leftv res, leftv args)
BOOLEAN nextAfaceToCheck(leftv res, leftv args)
gfan::ZVector getInteriorPoint()
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
static int index(p_Length length, p_Ord ord)
INLINE_THIS void Init(int l=0)
const Variable & v
< [in] a sqrfree bivariate poly
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
BOOLEAN dimension(leftv res, leftv args)
gfan::ZVector interiorPoint
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
BOOLEAN checkSigns(leftv res, leftv args)
static gfan::ZCone subcone(const lists &cones, const gfan::ZVector &point)
coeffs basecoeffs() const
BOOLEAN equations(leftv res, leftv args)
void lambda(int **points, int sizePoints)
BOOLEAN ambientDimension(leftv res, leftv args)
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 FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
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), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
intvec * intToAface(unsigned int v0, int n, int k)
BOOLEAN refineCones(leftv res, leftv args)
static gitfan::facets interiorFacets(const gfan::ZCone &zc, const gfan::ZCone &bound)