1 | #include <kernel/mod2.h> |
---|
2 | |
---|
3 | #include <gfanlib/gfanlib.h> |
---|
4 | #include <gfanlib/gfanlib_q.h> |
---|
5 | |
---|
6 | #include <Singular/ipid.h> |
---|
7 | #include <Singular/ipshell.h> |
---|
8 | #include <Singular/blackbox.h> |
---|
9 | #include <misc/intvec.h> |
---|
10 | #include <misc/sirandom.h> |
---|
11 | #include <coeffs/longrat.h> |
---|
12 | #include <coeffs/bigintmat.h> |
---|
13 | |
---|
14 | #include <bbfan.h> |
---|
15 | #include <bbpolytope.h> |
---|
16 | #include <sstream> |
---|
17 | |
---|
18 | #include "Singular/ipid.h" |
---|
19 | |
---|
20 | // #include <omalloc/omalloc.h> |
---|
21 | // #include <kernel/intvec.h> |
---|
22 | // #include <kernel/longrat.h> |
---|
23 | // #include <Singular/lists.h> |
---|
24 | // #include <Singular/subexpr.h> |
---|
25 | |
---|
26 | int coneID; |
---|
27 | |
---|
28 | number integerToNumber(const gfan::Integer &I) |
---|
29 | { |
---|
30 | mpz_t i; |
---|
31 | mpz_init(i); |
---|
32 | I.setGmp(i); |
---|
33 | long m = 268435456; |
---|
34 | if(mpz_cmp_si(i,m)) |
---|
35 | { |
---|
36 | int temp = (int) mpz_get_si(i); |
---|
37 | return n_Init(temp,coeffs_BIGINT); |
---|
38 | } |
---|
39 | else |
---|
40 | return n_InitMPZ(i,coeffs_BIGINT); |
---|
41 | } |
---|
42 | |
---|
43 | bigintmat* zVectorToBigintmat(const gfan::ZVector &zv) |
---|
44 | { |
---|
45 | int d=zv.size(); |
---|
46 | bigintmat* bim = new bigintmat(1,d,coeffs_BIGINT); |
---|
47 | for(int i=1;i<=d;i++) |
---|
48 | { |
---|
49 | number temp = integerToNumber(zv[i-1]); |
---|
50 | bim->set(1,i,temp); |
---|
51 | n_Delete(&temp,coeffs_BIGINT); |
---|
52 | } |
---|
53 | return bim; |
---|
54 | } |
---|
55 | |
---|
56 | bigintmat* zMatrixToBigintmat(const gfan::ZMatrix &zm) |
---|
57 | { |
---|
58 | int d=zm.getHeight(); |
---|
59 | int n=zm.getWidth(); |
---|
60 | bigintmat* bim = new bigintmat(d,n,coeffs_BIGINT); |
---|
61 | for(int i=1;i<=d;i++) |
---|
62 | for(int j=1; j<=n; j++) |
---|
63 | { |
---|
64 | number temp = integerToNumber(zm[i-1][j-1]); |
---|
65 | bim->set(i,j,temp); |
---|
66 | n_Delete(&temp,coeffs_BIGINT); |
---|
67 | } |
---|
68 | return bim; |
---|
69 | } |
---|
70 | |
---|
71 | gfan::Integer* numberToInteger(const number &n) |
---|
72 | { |
---|
73 | if (SR_HDL(n) & SR_INT) |
---|
74 | return new gfan::Integer(SR_TO_INT(n)); |
---|
75 | else |
---|
76 | return new gfan::Integer(n->z); |
---|
77 | } |
---|
78 | |
---|
79 | gfan::ZMatrix* bigintmatToZMatrix(const bigintmat &bim) |
---|
80 | { |
---|
81 | int d=bim.rows(); |
---|
82 | int n=bim.cols(); |
---|
83 | gfan::ZMatrix* zm = new gfan::ZMatrix(d,n); |
---|
84 | for(int i=0;i<d;i++) |
---|
85 | for(int j=0;j<n;j++) |
---|
86 | { |
---|
87 | number temp = BIMATELEM(bim, i+1, j+1); |
---|
88 | gfan::Integer* gi = numberToInteger(temp); |
---|
89 | (*zm)[i][j] = *gi; |
---|
90 | delete gi; |
---|
91 | } |
---|
92 | return zm; |
---|
93 | } |
---|
94 | |
---|
95 | gfan::ZVector* bigintmatToZVector(const bigintmat &bim) |
---|
96 | { |
---|
97 | gfan::ZVector* zv=new gfan::ZVector(bim.cols()); |
---|
98 | for(int j=0; j<bim.cols(); j++) |
---|
99 | { |
---|
100 | number temp = BIMATELEM(bim, 1, j+1); |
---|
101 | gfan::Integer* gi = numberToInteger(temp); |
---|
102 | (*zv)[j] = *gi; |
---|
103 | n_Delete(&temp,coeffs_BIGINT); |
---|
104 | delete gi; |
---|
105 | } |
---|
106 | return zv; |
---|
107 | } |
---|
108 | |
---|
109 | char* toString(gfan::ZMatrix const &zm) |
---|
110 | { |
---|
111 | bigintmat* bim = zMatrixToBigintmat(zm); |
---|
112 | char* s = bim->StringAsPrinted(); |
---|
113 | if (s==NULL) |
---|
114 | s = (char*) omAlloc0(sizeof(char)); |
---|
115 | delete bim; |
---|
116 | return s; |
---|
117 | } |
---|
118 | |
---|
119 | std::string toString(const gfan::ZCone* const c) |
---|
120 | { |
---|
121 | std::stringstream s; |
---|
122 | s<<"AMBIENT_DIM"<<std::endl; |
---|
123 | s<<c->ambientDimension()<<std::endl; |
---|
124 | |
---|
125 | gfan::ZMatrix i=c->getInequalities(); |
---|
126 | char* ineqs = toString(i); |
---|
127 | if (c->areFacetsKnown()) |
---|
128 | s<<"FACETS"<<std::endl; |
---|
129 | else |
---|
130 | s<<"INEQUALITIES"<<std::endl; |
---|
131 | if (ineqs!=NULL) |
---|
132 | { |
---|
133 | s<<ineqs<<std::endl; |
---|
134 | omFree(ineqs); |
---|
135 | } |
---|
136 | |
---|
137 | gfan::ZMatrix e=c->getEquations(); |
---|
138 | char* eqs = toString(e); |
---|
139 | if (c->areImpliedEquationsKnown()) |
---|
140 | s<<"LINEAR_SPAN"<<std::endl; |
---|
141 | else |
---|
142 | s<<"EQUATIONS"<<std::endl; |
---|
143 | if (eqs!=NULL) |
---|
144 | { |
---|
145 | s<<eqs<<std::endl; |
---|
146 | omFree(eqs); |
---|
147 | } |
---|
148 | |
---|
149 | if (c->areExtremeRaysKnown()) |
---|
150 | { |
---|
151 | gfan::ZMatrix r=c->extremeRays(); |
---|
152 | char* rs = toString(r); |
---|
153 | s<<"RAYS"<<std::endl; |
---|
154 | if (rs!=NULL) |
---|
155 | { |
---|
156 | s<<rs<<std::endl; |
---|
157 | omFree(rs); |
---|
158 | } |
---|
159 | gfan::ZMatrix l=c->generatorsOfLinealitySpace(); |
---|
160 | char* ls = toString(l); |
---|
161 | s<<"LINEALITY_SPACE"<<std::endl; |
---|
162 | if (ls!=NULL) |
---|
163 | { |
---|
164 | s<<ls<<std::endl; |
---|
165 | omFree(ls); |
---|
166 | } |
---|
167 | } |
---|
168 | |
---|
169 | return s.str(); |
---|
170 | } |
---|
171 | |
---|
172 | void* bbcone_Init(blackbox* /*b*/) |
---|
173 | { |
---|
174 | return (void*)(new gfan::ZCone()); |
---|
175 | } |
---|
176 | |
---|
177 | BOOLEAN bbcone_Assign(leftv l, leftv r) |
---|
178 | { |
---|
179 | gfan::ZCone* newZc; |
---|
180 | if (r==NULL) |
---|
181 | { |
---|
182 | if (l->Data()!=NULL) |
---|
183 | { |
---|
184 | gfan::ZCone* zd = (gfan::ZCone*)l->Data(); |
---|
185 | delete zd; |
---|
186 | } |
---|
187 | newZc = new gfan::ZCone(); |
---|
188 | } |
---|
189 | else if (r->Typ()==l->Typ()) |
---|
190 | { |
---|
191 | if (l->Data()!=NULL) |
---|
192 | { |
---|
193 | gfan::ZCone* zd = (gfan::ZCone*)l->Data(); |
---|
194 | delete zd; |
---|
195 | } |
---|
196 | gfan::ZCone* zc = (gfan::ZCone*)r->Data(); |
---|
197 | newZc = new gfan::ZCone(*zc); |
---|
198 | } |
---|
199 | else if (r->Typ()==INT_CMD) |
---|
200 | { |
---|
201 | int ambientDim = (int)(long)r->Data(); |
---|
202 | if (ambientDim < 0) |
---|
203 | { |
---|
204 | Werror("expected an int >= 0, but got %d", ambientDim); |
---|
205 | return TRUE; |
---|
206 | } |
---|
207 | if (l->Data()!=NULL) |
---|
208 | { |
---|
209 | gfan::ZCone* zd = (gfan::ZCone*)l->Data(); |
---|
210 | delete zd; |
---|
211 | } |
---|
212 | newZc = new gfan::ZCone(ambientDim); |
---|
213 | } |
---|
214 | else |
---|
215 | { |
---|
216 | Werror("assign Type(%d) = Type(%d) not implemented",l->Typ(),r->Typ()); |
---|
217 | return TRUE; |
---|
218 | } |
---|
219 | |
---|
220 | if (l->rtyp==IDHDL) |
---|
221 | { |
---|
222 | IDDATA((idhdl)l->data)=(char*) newZc; |
---|
223 | } |
---|
224 | else |
---|
225 | { |
---|
226 | l->data=(void *)newZc; |
---|
227 | } |
---|
228 | return FALSE; |
---|
229 | } |
---|
230 | |
---|
231 | char* bbcone_String(blackbox* /*b*/, void *d) |
---|
232 | { |
---|
233 | if (d==NULL) return omStrDup("invalid object"); |
---|
234 | else |
---|
235 | { |
---|
236 | std::string s=toString((gfan::ZCone*) d); |
---|
237 | return omStrDup(s.c_str()); |
---|
238 | } |
---|
239 | } |
---|
240 | |
---|
241 | void bbcone_destroy(blackbox* /*b*/, void *d) |
---|
242 | { |
---|
243 | if (d!=NULL) |
---|
244 | { |
---|
245 | gfan::ZCone* zc = (gfan::ZCone*) d; |
---|
246 | delete zc; |
---|
247 | } |
---|
248 | } |
---|
249 | |
---|
250 | void* bbcone_Copy(blackbox* /*b*/, void *d) |
---|
251 | { |
---|
252 | gfan::ZCone* zc = (gfan::ZCone*)d; |
---|
253 | gfan::ZCone* newZc = new gfan::ZCone(*zc); |
---|
254 | return newZc; |
---|
255 | } |
---|
256 | |
---|
257 | static BOOLEAN bbcone_Op2(int op, leftv res, leftv i1, leftv i2) |
---|
258 | { |
---|
259 | gfan::ZCone* zp = (gfan::ZCone*) i1->Data(); |
---|
260 | switch(op) |
---|
261 | { |
---|
262 | case '&': |
---|
263 | { |
---|
264 | if (i2->Typ()==coneID) |
---|
265 | { |
---|
266 | gfan::ZCone* zq = (gfan::ZCone*) i2->Data(); |
---|
267 | int d1 = zp->ambientDimension(); |
---|
268 | int d2 = zq->ambientDimension(); |
---|
269 | if (d1 != d2) |
---|
270 | { |
---|
271 | WerrorS("mismatching ambient dimensions"); |
---|
272 | return TRUE; |
---|
273 | } |
---|
274 | gfan::ZCone* zs = new gfan::ZCone(); |
---|
275 | *zs = gfan::intersection(*zp, *zq); |
---|
276 | zs->canonicalize(); |
---|
277 | res->rtyp = coneID; |
---|
278 | res->data = (void*) zs; |
---|
279 | return FALSE; |
---|
280 | } |
---|
281 | return blackboxDefaultOp2(op,res,i1,i2); |
---|
282 | } |
---|
283 | case '|': |
---|
284 | { |
---|
285 | if(i2->Typ()==coneID) |
---|
286 | { |
---|
287 | gfan::ZCone* zq = (gfan::ZCone*) i2->Data(); |
---|
288 | int d1 = zp->ambientDimension(); |
---|
289 | int d2 = zq->ambientDimension(); |
---|
290 | if (d1 != d2) |
---|
291 | { |
---|
292 | WerrorS("mismatching ambient dimensions"); |
---|
293 | return TRUE; |
---|
294 | } |
---|
295 | gfan::ZMatrix rays = zp->extremeRays(); |
---|
296 | rays.append(zq->extremeRays()); |
---|
297 | gfan::ZMatrix lineality = zp->generatorsOfLinealitySpace(); |
---|
298 | lineality.append(zq->generatorsOfLinealitySpace()); |
---|
299 | gfan::ZCone* zs = new gfan::ZCone(); |
---|
300 | *zs = gfan::ZCone::givenByRays(rays,lineality); |
---|
301 | zs->canonicalize(); |
---|
302 | res->rtyp = coneID; |
---|
303 | res->data = (void*) zs; |
---|
304 | return FALSE; |
---|
305 | } |
---|
306 | return blackboxDefaultOp2(op,res,i1,i2); |
---|
307 | } |
---|
308 | case EQUAL_EQUAL: |
---|
309 | { |
---|
310 | if(i2->Typ()==coneID) |
---|
311 | { |
---|
312 | gfan::ZCone* zq = (gfan::ZCone*) i2->Data(); |
---|
313 | zp->canonicalize(); |
---|
314 | zq->canonicalize(); |
---|
315 | bool b = !((*zp)!=(*zq)); |
---|
316 | res->rtyp = INT_CMD; |
---|
317 | res->data = (void*) b; |
---|
318 | return FALSE; |
---|
319 | } |
---|
320 | return blackboxDefaultOp2(op,res,i1,i2); |
---|
321 | } |
---|
322 | default: |
---|
323 | return blackboxDefaultOp2(op,res,i1,i2); |
---|
324 | } |
---|
325 | return blackboxDefaultOp2(op,res,i1,i2); |
---|
326 | } |
---|
327 | |
---|
328 | |
---|
329 | /* singular wrapper for gfanlib functions */ |
---|
330 | static BOOLEAN jjCONENORMALS1(leftv res, leftv v) |
---|
331 | { |
---|
332 | /* method for generating a cone object from inequalities; |
---|
333 | valid parametrizations: (intmat) */ |
---|
334 | bigintmat* ineq = NULL; |
---|
335 | if (v->Typ() == INTMAT_CMD) |
---|
336 | { |
---|
337 | intvec* ineq0 = (intvec*) v->Data(); |
---|
338 | ineq = iv2bim(ineq0,coeffs_BIGINT); |
---|
339 | } |
---|
340 | else |
---|
341 | ineq = (bigintmat*) v->Data(); |
---|
342 | gfan::ZMatrix* zm = bigintmatToZMatrix(ineq); |
---|
343 | gfan::ZCone* zc = new gfan::ZCone(*zm, gfan::ZMatrix(0, zm->getWidth())); |
---|
344 | delete zm; |
---|
345 | if (v->Typ() == INTMAT_CMD) |
---|
346 | delete ineq; |
---|
347 | res->rtyp = coneID; |
---|
348 | res->data = (void*) zc; |
---|
349 | return FALSE; |
---|
350 | } |
---|
351 | |
---|
352 | static BOOLEAN jjCONENORMALS2(leftv res, leftv u, leftv v) |
---|
353 | { |
---|
354 | /* method for generating a cone object from iequalities, |
---|
355 | and equations (...) |
---|
356 | valid parametrizations: (intmat, intmat) |
---|
357 | Errors will be invoked in the following cases: |
---|
358 | - u and v have different numbers of columns */ |
---|
359 | bigintmat* ineq = NULL; bigintmat* eq = NULL; |
---|
360 | if (u->Typ() == INTMAT_CMD) |
---|
361 | { |
---|
362 | intvec* ineq0 = (intvec*) u->Data(); |
---|
363 | ineq = iv2bim(ineq0,coeffs_BIGINT); |
---|
364 | } |
---|
365 | else |
---|
366 | ineq = (bigintmat*) u->Data(); |
---|
367 | if (v->Typ() == INTMAT_CMD) |
---|
368 | { |
---|
369 | intvec* eq0 = (intvec*) v->Data(); |
---|
370 | eq = iv2bim(eq0,coeffs_BIGINT); |
---|
371 | } |
---|
372 | else |
---|
373 | eq = (bigintmat*) v->Data(); |
---|
374 | |
---|
375 | if (ineq->cols() != eq->cols()) |
---|
376 | { |
---|
377 | Werror("expected same number of columns but got %d vs. %d", |
---|
378 | ineq->cols(), eq->cols()); |
---|
379 | return TRUE; |
---|
380 | } |
---|
381 | gfan::ZMatrix* zm1 = bigintmatToZMatrix(ineq); |
---|
382 | gfan::ZMatrix* zm2 = bigintmatToZMatrix(eq); |
---|
383 | gfan::ZCone* zc = new gfan::ZCone(*zm1, *zm2); |
---|
384 | delete zm1; |
---|
385 | delete zm2; |
---|
386 | if (u->Typ() == INTMAT_CMD) |
---|
387 | delete ineq; |
---|
388 | if (v->Typ() == INTMAT_CMD) |
---|
389 | delete eq; |
---|
390 | res->rtyp = coneID; |
---|
391 | res->data = (void*) zc; |
---|
392 | return FALSE; |
---|
393 | } |
---|
394 | |
---|
395 | static BOOLEAN jjCONENORMALS3(leftv res, leftv u, leftv v, leftv w) |
---|
396 | { |
---|
397 | /* method for generating a cone object from inequalities, equations, |
---|
398 | and an integer k; |
---|
399 | valid parametrizations: (intmat, intmat, int); |
---|
400 | Errors will be invoked in the following cases: |
---|
401 | - u and v have different numbers of columns, |
---|
402 | - k not in [0..3]; |
---|
403 | if the 2^0-bit of k is set, then ... */ |
---|
404 | bigintmat* ineq = NULL; bigintmat* eq = NULL; |
---|
405 | if (u->Typ() == INTMAT_CMD) |
---|
406 | { |
---|
407 | intvec* ineq0 = (intvec*) u->Data(); |
---|
408 | ineq = iv2bim(ineq0,coeffs_BIGINT); |
---|
409 | } |
---|
410 | else |
---|
411 | ineq = (bigintmat*) u->Data(); |
---|
412 | if (v->Typ() == INTMAT_CMD) |
---|
413 | { |
---|
414 | intvec* eq0 = (intvec*) v->Data(); |
---|
415 | eq = iv2bim(eq0,coeffs_BIGINT); |
---|
416 | } |
---|
417 | else |
---|
418 | eq = (bigintmat*) v->Data(); |
---|
419 | if (ineq->cols() != eq->cols()) |
---|
420 | { |
---|
421 | Werror("expected same number of columns but got %d vs. %d", |
---|
422 | ineq->cols(), eq->cols()); |
---|
423 | return TRUE; |
---|
424 | } |
---|
425 | int k = (int)(long)w->Data(); |
---|
426 | if ((k < 0) || (k > 3)) |
---|
427 | { |
---|
428 | WerrorS("expected int argument in [0..3]"); |
---|
429 | return TRUE; |
---|
430 | } |
---|
431 | gfan::ZMatrix* zm1 = bigintmatToZMatrix(ineq); |
---|
432 | gfan::ZMatrix* zm2 = bigintmatToZMatrix(eq); |
---|
433 | gfan::ZCone* zc = new gfan::ZCone(*zm1, *zm2, k); |
---|
434 | delete zm1; |
---|
435 | delete zm2; |
---|
436 | if (u->Typ() == INTMAT_CMD) |
---|
437 | delete ineq; |
---|
438 | if (v->Typ() == INTMAT_CMD) |
---|
439 | delete eq; |
---|
440 | res->rtyp = coneID; |
---|
441 | res->data = (void*) zc; |
---|
442 | return FALSE; |
---|
443 | } |
---|
444 | |
---|
445 | BOOLEAN coneViaNormals(leftv res, leftv args) |
---|
446 | { |
---|
447 | leftv u = args; |
---|
448 | if ((u != NULL) && ((u->Typ() == BIGINTMAT_CMD) || (u->Typ() == INTMAT_CMD))) |
---|
449 | { |
---|
450 | if (u->next == NULL) return jjCONENORMALS1(res, u); |
---|
451 | } |
---|
452 | leftv v = u->next; |
---|
453 | if ((v != NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTMAT_CMD))) |
---|
454 | { |
---|
455 | if (v->next == NULL) return jjCONENORMALS2(res, u, v); |
---|
456 | } |
---|
457 | leftv w = v->next; |
---|
458 | if ((w != NULL) && (w->Typ() == INT_CMD)) |
---|
459 | { |
---|
460 | if (w->next == NULL) return jjCONENORMALS3(res, u, v, w); |
---|
461 | } |
---|
462 | WerrorS("coneViaInequalities: unexpected parameters"); |
---|
463 | return TRUE; |
---|
464 | } |
---|
465 | |
---|
466 | static BOOLEAN jjCONERAYS1(leftv res, leftv v) |
---|
467 | { |
---|
468 | /* method for generating a cone object from half-lines |
---|
469 | (cone = convex hull of the half-lines; note: there may be |
---|
470 | entire lines in the cone); |
---|
471 | valid parametrizations: (intmat) */ |
---|
472 | bigintmat* rays = NULL; |
---|
473 | if (v->Typ() == INTMAT_CMD) |
---|
474 | { |
---|
475 | intvec* rays0 = (intvec*) v->Data(); |
---|
476 | rays = iv2bim(rays0,coeffs_BIGINT); |
---|
477 | } |
---|
478 | else |
---|
479 | rays = (bigintmat*) v->Data(); |
---|
480 | |
---|
481 | gfan::ZMatrix* zm = bigintmatToZMatrix(rays); |
---|
482 | gfan::ZCone* zc = new gfan::ZCone(); |
---|
483 | *zc = gfan::ZCone::givenByRays(*zm, gfan::ZMatrix(0, zm->getWidth())); |
---|
484 | res->rtyp = coneID; |
---|
485 | res->data = (void*) zc; |
---|
486 | |
---|
487 | delete zm; |
---|
488 | if (v->Typ() == INTMAT_CMD) |
---|
489 | delete rays; |
---|
490 | return FALSE; |
---|
491 | } |
---|
492 | |
---|
493 | static BOOLEAN jjCONERAYS2(leftv res, leftv u, leftv v) |
---|
494 | { |
---|
495 | /* method for generating a cone object from half-lines, |
---|
496 | and lines (any point in the cone being the sum of a point |
---|
497 | in the convex hull of the half-lines and a point in the span |
---|
498 | of the lines; the second argument may contain or entirely consist |
---|
499 | of zero rows); |
---|
500 | valid parametrizations: (intmat, intmat) |
---|
501 | Errors will be invoked in the following cases: |
---|
502 | - u and v have different numbers of columns */ |
---|
503 | bigintmat* rays = NULL; bigintmat* linSpace = NULL; |
---|
504 | if (u->Typ() == INTMAT_CMD) |
---|
505 | { |
---|
506 | intvec* rays0 = (intvec*) u->Data(); |
---|
507 | rays = iv2bim(rays0,coeffs_BIGINT); |
---|
508 | } |
---|
509 | else |
---|
510 | rays = (bigintmat*) u->Data(); |
---|
511 | if (v->Typ() == INTMAT_CMD) |
---|
512 | { |
---|
513 | intvec* linSpace0 = (intvec*) v->Data(); |
---|
514 | linSpace = iv2bim(linSpace0,coeffs_BIGINT); |
---|
515 | } |
---|
516 | else |
---|
517 | linSpace = (bigintmat*) v->Data(); |
---|
518 | |
---|
519 | if (rays->cols() != linSpace->cols()) |
---|
520 | { |
---|
521 | Werror("expected same number of columns but got %d vs. %d", |
---|
522 | rays->cols(), linSpace->cols()); |
---|
523 | return TRUE; |
---|
524 | } |
---|
525 | gfan::ZMatrix* zm1 = bigintmatToZMatrix(rays); |
---|
526 | gfan::ZMatrix* zm2 = bigintmatToZMatrix(linSpace); |
---|
527 | gfan::ZCone* zc = new gfan::ZCone(); |
---|
528 | *zc = gfan::ZCone::givenByRays(*zm1, *zm2); |
---|
529 | res->rtyp = coneID; |
---|
530 | res->data = (void*) zc; |
---|
531 | |
---|
532 | delete zm1; |
---|
533 | delete zm2; |
---|
534 | if (u->Typ() == INTMAT_CMD) |
---|
535 | delete rays; |
---|
536 | if (v->Typ() == INTMAT_CMD) |
---|
537 | delete linSpace; |
---|
538 | return FALSE; |
---|
539 | } |
---|
540 | |
---|
541 | static BOOLEAN jjCONERAYS3(leftv res, leftv u, leftv v, leftv w) |
---|
542 | { |
---|
543 | /* method for generating a cone object from half-lines, |
---|
544 | and lines (any point in the cone being the sum of a point |
---|
545 | in the convex hull of the half-lines and a point in the span |
---|
546 | of the lines), and an integer k; |
---|
547 | valid parametrizations: (intmat, intmat, int); |
---|
548 | Errors will be invoked in the following cases: |
---|
549 | - u and v have different numbers of columns, |
---|
550 | - k not in [0..3]; |
---|
551 | if the 2^0-bit of k is set, then the lineality space is known |
---|
552 | to be the span of the provided lines; |
---|
553 | if the 2^1-bit of k is set, then the extreme rays are known: |
---|
554 | each half-line spans a (different) extreme ray */ |
---|
555 | bigintmat* rays = NULL; bigintmat* linSpace = NULL; |
---|
556 | if (u->Typ() == INTMAT_CMD) |
---|
557 | { |
---|
558 | intvec* rays0 = (intvec*) u->Data(); |
---|
559 | rays = iv2bim(rays0,coeffs_BIGINT); |
---|
560 | } |
---|
561 | else |
---|
562 | rays = (bigintmat*) u->Data(); |
---|
563 | if (v->Typ() == INTMAT_CMD) |
---|
564 | { |
---|
565 | intvec* linSpace0 = (intvec*) v->Data(); |
---|
566 | linSpace = iv2bim(linSpace0,coeffs_BIGINT); |
---|
567 | } |
---|
568 | else |
---|
569 | linSpace = (bigintmat*) v->Data(); |
---|
570 | |
---|
571 | if (rays->cols() != linSpace->cols()) |
---|
572 | { |
---|
573 | Werror("expected same number of columns but got %d vs. %d", |
---|
574 | rays->cols(), linSpace->cols()); |
---|
575 | return TRUE; |
---|
576 | } |
---|
577 | int k = (int)(long)w->Data(); |
---|
578 | if ((k < 0) || (k > 3)) |
---|
579 | { |
---|
580 | WerrorS("expected int argument in [0..3]"); |
---|
581 | return TRUE; |
---|
582 | } |
---|
583 | gfan::ZMatrix* zm1 = bigintmatToZMatrix(rays); |
---|
584 | gfan::ZMatrix* zm2 = bigintmatToZMatrix(linSpace); |
---|
585 | gfan::ZCone* zc = new gfan::ZCone(); |
---|
586 | *zc = gfan::ZCone::givenByRays(*zm1, *zm2); |
---|
587 | //k should be passed on to zc; not available yet |
---|
588 | res->rtyp = coneID; |
---|
589 | res->data = (void*) zc; |
---|
590 | |
---|
591 | delete zm1; |
---|
592 | delete zm2; |
---|
593 | if (u->Typ() == INTMAT_CMD) |
---|
594 | delete rays; |
---|
595 | if (v->Typ() == INTMAT_CMD) |
---|
596 | delete linSpace; |
---|
597 | return FALSE; |
---|
598 | } |
---|
599 | |
---|
600 | BOOLEAN coneViaRays(leftv res, leftv args) |
---|
601 | { |
---|
602 | leftv u = args; |
---|
603 | if ((u != NULL) && ((u->Typ() == BIGINTMAT_CMD) || (u->Typ() == INTMAT_CMD))) |
---|
604 | { |
---|
605 | if (u->next == NULL) return jjCONERAYS1(res, u); |
---|
606 | leftv v = u->next; |
---|
607 | if ((v != NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTMAT_CMD))) |
---|
608 | { |
---|
609 | if (v->next == NULL) return jjCONERAYS2(res, u, v); |
---|
610 | leftv w = v->next; |
---|
611 | if ((w != NULL) && (w->Typ() == INT_CMD)) |
---|
612 | { |
---|
613 | if (w->next == NULL) return jjCONERAYS3(res, u, v, w); |
---|
614 | } |
---|
615 | } |
---|
616 | } |
---|
617 | WerrorS("coneViaPoints: unexpected parameters"); |
---|
618 | return TRUE; |
---|
619 | } |
---|
620 | |
---|
621 | BOOLEAN inequalities(leftv res, leftv args) |
---|
622 | { |
---|
623 | leftv u = args; |
---|
624 | if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID)) |
---|
625 | { |
---|
626 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
627 | |
---|
628 | gfan::ZMatrix zmat = zc->getInequalities(); |
---|
629 | res->rtyp = BIGINTMAT_CMD; |
---|
630 | res->data = (void*) zMatrixToBigintmat(zmat); |
---|
631 | return FALSE; |
---|
632 | } |
---|
633 | WerrorS("inequalities: unexpected parameters"); |
---|
634 | return TRUE; |
---|
635 | } |
---|
636 | |
---|
637 | BOOLEAN equations(leftv res, leftv args) |
---|
638 | { |
---|
639 | leftv u = args; |
---|
640 | if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID)) |
---|
641 | { |
---|
642 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
643 | gfan::ZMatrix zmat = zc->getEquations(); |
---|
644 | res->rtyp = BIGINTMAT_CMD; |
---|
645 | res->data = (void*) zMatrixToBigintmat(zmat); |
---|
646 | return FALSE; |
---|
647 | } |
---|
648 | WerrorS("equations: unexpected parameters"); |
---|
649 | return TRUE; |
---|
650 | } |
---|
651 | |
---|
652 | BOOLEAN facets(leftv res, leftv args) |
---|
653 | { |
---|
654 | leftv u = args; |
---|
655 | if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID)) |
---|
656 | { |
---|
657 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
658 | gfan::ZMatrix zm = zc->getFacets(); |
---|
659 | res->rtyp = BIGINTMAT_CMD; |
---|
660 | res->data = (void*) zMatrixToBigintmat(zm); |
---|
661 | return FALSE; |
---|
662 | } |
---|
663 | WerrorS("facets: unexpected parameters"); |
---|
664 | return TRUE; |
---|
665 | } |
---|
666 | |
---|
667 | BOOLEAN impliedEquations(leftv res, leftv args) |
---|
668 | { |
---|
669 | leftv u = args; |
---|
670 | if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID)) |
---|
671 | { |
---|
672 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
673 | gfan::ZMatrix zmat = zc->getImpliedEquations(); |
---|
674 | res->rtyp = BIGINTMAT_CMD; |
---|
675 | res->data = (void*) zMatrixToBigintmat(zmat); |
---|
676 | return FALSE; |
---|
677 | } |
---|
678 | WerrorS("span: unexpected parameters"); |
---|
679 | return TRUE; |
---|
680 | } |
---|
681 | |
---|
682 | BOOLEAN generatorsOfSpan(leftv res, leftv args) |
---|
683 | { |
---|
684 | leftv u = args; |
---|
685 | if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID)) |
---|
686 | { |
---|
687 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
688 | gfan::ZMatrix zmat = zc->generatorsOfSpan(); |
---|
689 | res->rtyp = BIGINTMAT_CMD; |
---|
690 | res->data = (void*) zMatrixToBigintmat(zmat); |
---|
691 | return FALSE; |
---|
692 | } |
---|
693 | WerrorS("generatorsOfSpan: unexpected parameters"); |
---|
694 | return TRUE; |
---|
695 | } |
---|
696 | |
---|
697 | BOOLEAN generatorsOfLinealitySpace(leftv res, leftv args) |
---|
698 | { |
---|
699 | leftv u = args; |
---|
700 | if ((u != NULL) && (u->Typ() == coneID || u->Typ() == polytopeID)) |
---|
701 | { |
---|
702 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
703 | gfan::ZMatrix zmat = zc->generatorsOfLinealitySpace(); |
---|
704 | res->rtyp = BIGINTMAT_CMD; |
---|
705 | res->data = (void*) zMatrixToBigintmat(zmat); |
---|
706 | return FALSE; |
---|
707 | } |
---|
708 | WerrorS("generatorsOfLinealitySpace: unexpected parameters"); |
---|
709 | return TRUE; |
---|
710 | } |
---|
711 | |
---|
712 | BOOLEAN rays(leftv res, leftv args) |
---|
713 | { |
---|
714 | leftv u = args; |
---|
715 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
716 | { |
---|
717 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
718 | gfan::ZMatrix zm = zc->extremeRays(); |
---|
719 | res->rtyp = BIGINTMAT_CMD; |
---|
720 | res->data = (void*)zMatrixToBigintmat(zm); |
---|
721 | return FALSE; |
---|
722 | } |
---|
723 | if ((u != NULL) && (u->Typ() == fanID)) |
---|
724 | { |
---|
725 | gfan::ZFan* zf = (gfan::ZFan*)u->Data(); |
---|
726 | gfan::ZMatrix zmat = rays(zf); |
---|
727 | res->rtyp = BIGINTMAT_CMD; |
---|
728 | res->data = (void*) zMatrixToBigintmat(zmat); |
---|
729 | return FALSE; |
---|
730 | } |
---|
731 | WerrorS("rays: unexpected parameters"); |
---|
732 | return TRUE; |
---|
733 | } |
---|
734 | |
---|
735 | BOOLEAN quotientLatticeBasis(leftv res, leftv args) |
---|
736 | { |
---|
737 | leftv u = args; |
---|
738 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
739 | { |
---|
740 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
741 | gfan::ZMatrix zmat = zc->quotientLatticeBasis(); |
---|
742 | res->rtyp = BIGINTMAT_CMD; |
---|
743 | res->data = (void*) zMatrixToBigintmat(zmat); |
---|
744 | return FALSE; |
---|
745 | } |
---|
746 | WerrorS("quotientLatticeBasis: unexpected parameters"); |
---|
747 | return TRUE; |
---|
748 | } |
---|
749 | |
---|
750 | BOOLEAN getLinearForms(leftv res, leftv args) |
---|
751 | { |
---|
752 | leftv u = args; |
---|
753 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
754 | { |
---|
755 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
756 | gfan::ZMatrix zmat = zc->getLinearForms(); |
---|
757 | res->rtyp = BIGINTMAT_CMD; |
---|
758 | res->data = (void*) zMatrixToBigintmat(zmat); |
---|
759 | return FALSE; |
---|
760 | } |
---|
761 | WerrorS("getLinearForms: unexpected parameters"); |
---|
762 | return TRUE; |
---|
763 | } |
---|
764 | |
---|
765 | BOOLEAN ambientDimension(leftv res, leftv args) |
---|
766 | { |
---|
767 | leftv u=args; |
---|
768 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
769 | { |
---|
770 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
771 | res->rtyp = INT_CMD; |
---|
772 | res->data = (void*) (long) zc->ambientDimension(); |
---|
773 | return FALSE; |
---|
774 | } |
---|
775 | if ((u != NULL) && (u->Typ() == fanID)) |
---|
776 | { |
---|
777 | gfan::ZFan* zf = (gfan::ZFan*)u->Data(); |
---|
778 | res->rtyp = INT_CMD; |
---|
779 | res->data = (void*) (long) getAmbientDimension(zf); |
---|
780 | return FALSE; |
---|
781 | } |
---|
782 | if ((u != NULL) && (u->Typ() == polytopeID)) |
---|
783 | { |
---|
784 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
785 | res->rtyp = INT_CMD; |
---|
786 | res->data = (void*) (long) getAmbientDimension(zc); |
---|
787 | return FALSE; |
---|
788 | } |
---|
789 | WerrorS("ambientDimension: unexpected parameters"); |
---|
790 | return TRUE; |
---|
791 | } |
---|
792 | |
---|
793 | BOOLEAN dimension(leftv res, leftv args) |
---|
794 | { |
---|
795 | leftv u=args; |
---|
796 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
797 | { |
---|
798 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
799 | res->rtyp = INT_CMD; |
---|
800 | res->data = (void*) (long) zc->dimension(); |
---|
801 | return FALSE; |
---|
802 | } |
---|
803 | if ((u != NULL) && (u->Typ() == fanID)) |
---|
804 | { |
---|
805 | gfan::ZFan* zf = (gfan::ZFan*)u->Data(); |
---|
806 | res->rtyp = INT_CMD; |
---|
807 | res->data = (void*) (long) getDimension(zf); |
---|
808 | return FALSE; |
---|
809 | } |
---|
810 | if ((u != NULL) && (u->Typ() == polytopeID)) |
---|
811 | { |
---|
812 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
813 | res->rtyp = INT_CMD; |
---|
814 | res->data = (void*) (long) getDimension(zc); |
---|
815 | return FALSE; |
---|
816 | } |
---|
817 | WerrorS("dimension: unexpected parameters"); |
---|
818 | return TRUE; |
---|
819 | } |
---|
820 | |
---|
821 | BOOLEAN codimension(leftv res, leftv args) |
---|
822 | { |
---|
823 | leftv u=args; |
---|
824 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
825 | { |
---|
826 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
827 | res->rtyp = INT_CMD; |
---|
828 | res->data = (void*) (long) zc->codimension(); |
---|
829 | return FALSE; |
---|
830 | } |
---|
831 | if ((u != NULL) && (u->Typ() == fanID)) |
---|
832 | { |
---|
833 | gfan::ZFan* zf = (gfan::ZFan*)u->Data(); |
---|
834 | res->rtyp = INT_CMD; |
---|
835 | res->data = (void*) (long) getCodimension(zf); |
---|
836 | return FALSE; |
---|
837 | } |
---|
838 | if ((u != NULL) && (u->Typ() == polytopeID)) |
---|
839 | { |
---|
840 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
841 | res->rtyp = INT_CMD; |
---|
842 | res->data = (void*) (long) getCodimension(zc); |
---|
843 | return FALSE; |
---|
844 | } |
---|
845 | WerrorS("getCodimension: unexpected parameters"); |
---|
846 | return TRUE; |
---|
847 | } |
---|
848 | |
---|
849 | BOOLEAN linealityDimension(leftv res, leftv args) |
---|
850 | { |
---|
851 | leftv u=args; |
---|
852 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
853 | { |
---|
854 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
855 | res->rtyp = INT_CMD; |
---|
856 | res->data = (void*) (long) zc->dimensionOfLinealitySpace(); |
---|
857 | return FALSE; |
---|
858 | } |
---|
859 | if ((u != NULL) && (u->Typ() == fanID)) |
---|
860 | { |
---|
861 | gfan::ZFan* zf = (gfan::ZFan*)u->Data(); |
---|
862 | res->rtyp = INT_CMD; |
---|
863 | res->data = (void*) (long) getLinealityDimension(zf); |
---|
864 | return FALSE; |
---|
865 | } |
---|
866 | WerrorS("linealityDimension: unexpected parameters"); |
---|
867 | return TRUE; |
---|
868 | } |
---|
869 | |
---|
870 | BOOLEAN getMultiplicity(leftv res, leftv args) |
---|
871 | { |
---|
872 | leftv u = args; |
---|
873 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
874 | { |
---|
875 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
876 | number i = integerToNumber(zc->getMultiplicity()); |
---|
877 | res->rtyp = BIGINT_CMD; |
---|
878 | res->data = (void*) i; |
---|
879 | return FALSE; |
---|
880 | } |
---|
881 | WerrorS("getMultiplicity: unexpected parameters"); |
---|
882 | return TRUE; |
---|
883 | } |
---|
884 | |
---|
885 | BOOLEAN isOrigin(leftv res, leftv args) |
---|
886 | { |
---|
887 | leftv u = args; |
---|
888 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
889 | { |
---|
890 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
891 | int i = zc->isOrigin(); |
---|
892 | res->rtyp = INT_CMD; |
---|
893 | res->data = (void*) (long) i; |
---|
894 | return FALSE; |
---|
895 | } |
---|
896 | WerrorS("isOrigin: unexpected parameters"); |
---|
897 | return TRUE; |
---|
898 | } |
---|
899 | |
---|
900 | BOOLEAN isFullSpace(leftv res, leftv args) |
---|
901 | { |
---|
902 | leftv u = args; |
---|
903 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
904 | { |
---|
905 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
906 | int i = zc->isFullSpace(); |
---|
907 | res->rtyp = INT_CMD; |
---|
908 | res->data = (void*) (long) i; |
---|
909 | return FALSE; |
---|
910 | } |
---|
911 | WerrorS("isFullSpace: unexpected parameters"); |
---|
912 | return TRUE; |
---|
913 | } |
---|
914 | |
---|
915 | BOOLEAN isSimplicial(leftv res, leftv args) |
---|
916 | { |
---|
917 | leftv u=args; |
---|
918 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
919 | { |
---|
920 | gfan::ZCone* zc = (gfan::ZCone*) u->Data(); |
---|
921 | int b = zc->isSimplicial(); |
---|
922 | res->rtyp = INT_CMD; |
---|
923 | res->data = (void*) (long) b; |
---|
924 | return FALSE; |
---|
925 | } |
---|
926 | if ((u != NULL) && (u->Typ() == fanID)) |
---|
927 | { |
---|
928 | gfan::ZFan* zf = (gfan::ZFan*) u->Data(); |
---|
929 | bool b = isSimplicial(zf); |
---|
930 | res->rtyp = INT_CMD; |
---|
931 | res->data = (void*) (long) b; |
---|
932 | return FALSE; |
---|
933 | } |
---|
934 | WerrorS("isSimplicial: unexpected parameters"); |
---|
935 | return TRUE; |
---|
936 | } |
---|
937 | |
---|
938 | BOOLEAN containsPositiveVector(leftv res, leftv args) |
---|
939 | { |
---|
940 | leftv u = args; |
---|
941 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
942 | { |
---|
943 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
944 | int i = zc->containsPositiveVector(); |
---|
945 | res->rtyp = INT_CMD; |
---|
946 | res->data = (void*) (long) i; |
---|
947 | return FALSE; |
---|
948 | } |
---|
949 | WerrorS("containsPositiveVector: unexpected parameters"); |
---|
950 | return TRUE; |
---|
951 | } |
---|
952 | |
---|
953 | BOOLEAN linealitySpace(leftv res, leftv args) |
---|
954 | { |
---|
955 | leftv u = args; |
---|
956 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
957 | { |
---|
958 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
959 | gfan::ZCone* zd = new gfan::ZCone(zc->linealitySpace()); |
---|
960 | res->rtyp = coneID; |
---|
961 | res->data = (void*) zd; |
---|
962 | return FALSE; |
---|
963 | } |
---|
964 | WerrorS("linealitySpace: unexpected parameters"); |
---|
965 | return TRUE; |
---|
966 | } |
---|
967 | |
---|
968 | BOOLEAN dualCone(leftv res, leftv args) |
---|
969 | { |
---|
970 | leftv u = args; |
---|
971 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
972 | { |
---|
973 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
974 | gfan::ZCone* zd = new gfan::ZCone(zc->dualCone()); |
---|
975 | res->rtyp = coneID; |
---|
976 | res->data = (void*) zd; |
---|
977 | return FALSE; |
---|
978 | } |
---|
979 | WerrorS("dual: unexpected parameters"); |
---|
980 | return TRUE; |
---|
981 | } |
---|
982 | |
---|
983 | BOOLEAN negatedCone(leftv res, leftv args) |
---|
984 | { |
---|
985 | leftv u = args; |
---|
986 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
987 | { |
---|
988 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
989 | gfan::ZCone* zd = new gfan::ZCone(zc->negated()); |
---|
990 | res->rtyp = coneID; |
---|
991 | res->data = (void*) zd; |
---|
992 | return FALSE; |
---|
993 | } |
---|
994 | WerrorS("negatedCone: unexpected parameters"); |
---|
995 | return TRUE; |
---|
996 | } |
---|
997 | |
---|
998 | BOOLEAN semigroupGenerator(leftv res, leftv args) |
---|
999 | { |
---|
1000 | leftv u = args; |
---|
1001 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
1002 | { |
---|
1003 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
1004 | int d = zc->dimension(); |
---|
1005 | int dLS = zc->dimensionOfLinealitySpace(); |
---|
1006 | if (d == dLS + 1) |
---|
1007 | { |
---|
1008 | gfan::ZVector zv = zc->semiGroupGeneratorOfRay(); |
---|
1009 | res->rtyp = BIGINTMAT_CMD; |
---|
1010 | res->data = (void*) zVectorToBigintmat(zv); |
---|
1011 | return FALSE; |
---|
1012 | } |
---|
1013 | Werror("expected dim of cone one larger than dim of lin space\n" |
---|
1014 | "but got dimensions %d and %d", d, dLS); |
---|
1015 | } |
---|
1016 | WerrorS("semigroupGenerator: unexpected parameters"); |
---|
1017 | return TRUE; |
---|
1018 | } |
---|
1019 | |
---|
1020 | BOOLEAN relativeInteriorPoint(leftv res, leftv args) |
---|
1021 | { |
---|
1022 | leftv u = args; |
---|
1023 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
1024 | { |
---|
1025 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
1026 | gfan::ZVector zv = zc->getRelativeInteriorPoint(); |
---|
1027 | res->rtyp = BIGINTMAT_CMD; |
---|
1028 | res->data = (void*) zVectorToBigintmat(zv); |
---|
1029 | return FALSE; |
---|
1030 | } |
---|
1031 | WerrorS("relativeInteriorPoint: unexpected parameters"); |
---|
1032 | return TRUE; |
---|
1033 | } |
---|
1034 | |
---|
1035 | BOOLEAN uniquePoint(leftv res, leftv args) |
---|
1036 | { |
---|
1037 | leftv u = args; |
---|
1038 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
1039 | { |
---|
1040 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
1041 | gfan::ZVector zv = zc->getUniquePoint(); |
---|
1042 | res->rtyp = BIGINTMAT_CMD; |
---|
1043 | res->data = (void*) zVectorToBigintmat(zv); |
---|
1044 | return FALSE; |
---|
1045 | } |
---|
1046 | WerrorS("uniquePoint: unexpected parameters"); |
---|
1047 | return TRUE; |
---|
1048 | } |
---|
1049 | |
---|
1050 | gfan::ZVector randomPoint(const gfan::ZCone* zc) |
---|
1051 | { |
---|
1052 | gfan::ZMatrix rays = zc->extremeRays(); |
---|
1053 | gfan::ZVector rp = gfan::ZVector(zc->ambientDimension()); |
---|
1054 | for (int i=0; i<rays.getHeight(); i++) |
---|
1055 | { |
---|
1056 | int n = siRand(); |
---|
1057 | rp = rp + n * rays[i]; |
---|
1058 | } |
---|
1059 | return rp; |
---|
1060 | } |
---|
1061 | |
---|
1062 | BOOLEAN randomPoint(leftv res, leftv args) |
---|
1063 | { |
---|
1064 | leftv u = args; |
---|
1065 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
1066 | { |
---|
1067 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
1068 | gfan::ZVector zv = randomPoint(zc); |
---|
1069 | res->rtyp = BIGINTMAT_CMD; |
---|
1070 | res->data = (void*) zVectorToBigintmat(zv); |
---|
1071 | return FALSE; |
---|
1072 | } |
---|
1073 | WerrorS("randomPoint: unexpected parameters"); |
---|
1074 | return TRUE; |
---|
1075 | } |
---|
1076 | |
---|
1077 | BOOLEAN setMultiplicity(leftv res, leftv args) |
---|
1078 | { |
---|
1079 | leftv u = args; |
---|
1080 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
1081 | { |
---|
1082 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
1083 | leftv v = u->next; |
---|
1084 | if ((v != NULL) && (v->Typ() == INT_CMD)) |
---|
1085 | { |
---|
1086 | int val = (int)(long)v->Data(); |
---|
1087 | zc->setMultiplicity(gfan::Integer(val)); |
---|
1088 | res->rtyp = NONE; |
---|
1089 | res->data = NULL; |
---|
1090 | return FALSE; |
---|
1091 | } |
---|
1092 | } |
---|
1093 | WerrorS("setMultiplicity: unexpected parameters"); |
---|
1094 | return TRUE; |
---|
1095 | } |
---|
1096 | |
---|
1097 | BOOLEAN setLinearForms(leftv res, leftv args) |
---|
1098 | { |
---|
1099 | leftv u = args; |
---|
1100 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
1101 | { |
---|
1102 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
1103 | leftv v = u->next; |
---|
1104 | if ((v != NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTVEC_CMD))) |
---|
1105 | { |
---|
1106 | bigintmat* mat=NULL; |
---|
1107 | if (v->Typ() == INTVEC_CMD) |
---|
1108 | { |
---|
1109 | intvec* mat0 = (intvec*) v->Data(); |
---|
1110 | mat = iv2bim(mat0,coeffs_BIGINT)->transpose(); |
---|
1111 | } |
---|
1112 | else |
---|
1113 | mat = (bigintmat*) v->Data(); |
---|
1114 | gfan::ZMatrix* zm = bigintmatToZMatrix(mat); |
---|
1115 | zc->setLinearForms(*zm); |
---|
1116 | res->rtyp = NONE; |
---|
1117 | res->data = NULL; |
---|
1118 | |
---|
1119 | delete zm; |
---|
1120 | if (v->Typ() == INTVEC_CMD) |
---|
1121 | delete mat; |
---|
1122 | return FALSE; |
---|
1123 | } |
---|
1124 | } |
---|
1125 | WerrorS("setLinearForms: unexpected parameters"); |
---|
1126 | return TRUE; |
---|
1127 | } |
---|
1128 | |
---|
1129 | gfan::ZMatrix liftUp(const gfan::ZMatrix &zm) |
---|
1130 | { |
---|
1131 | int r=zm.getHeight(); |
---|
1132 | int c=zm.getWidth(); |
---|
1133 | gfan::ZMatrix zn(r+1,c+1); |
---|
1134 | zn[1][1]=1; |
---|
1135 | for (int i=0; i<r; i++) |
---|
1136 | for (int j=0; j<c; j++) |
---|
1137 | zn[i+1][j+1]=zm[i][j]; |
---|
1138 | return zn; |
---|
1139 | } |
---|
1140 | |
---|
1141 | gfan::ZCone liftUp(const gfan::ZCone &zc) |
---|
1142 | { |
---|
1143 | gfan::ZMatrix ineq=zc.getInequalities(); |
---|
1144 | gfan::ZMatrix eq=zc.getEquations(); |
---|
1145 | gfan::ZCone zd(liftUp(ineq),liftUp(eq)); |
---|
1146 | return zd; |
---|
1147 | } |
---|
1148 | |
---|
1149 | BOOLEAN coneToPolytope(leftv res, leftv args) |
---|
1150 | { |
---|
1151 | leftv u = args; |
---|
1152 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
1153 | { |
---|
1154 | gfan::ZCone* zc = (gfan::ZCone*) u->Data(); |
---|
1155 | gfan::ZMatrix ineq=zc->getInequalities(); |
---|
1156 | gfan::ZMatrix eq=zc->getEquations(); |
---|
1157 | gfan::ZCone* zd = new gfan::ZCone(liftUp(ineq),liftUp(eq)); |
---|
1158 | res->rtyp = polytopeID; |
---|
1159 | res->data = (void*) zd; |
---|
1160 | return FALSE; |
---|
1161 | } |
---|
1162 | WerrorS("makePolytope: unexpected parameters"); |
---|
1163 | return TRUE; |
---|
1164 | } |
---|
1165 | |
---|
1166 | BOOLEAN intersectCones(leftv res, leftv args) |
---|
1167 | { |
---|
1168 | leftv u = args; |
---|
1169 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
1170 | { |
---|
1171 | leftv v = u->next; |
---|
1172 | if ((v != NULL) && (v->Typ() == coneID)) |
---|
1173 | { |
---|
1174 | gfan::ZCone* zc1 = (gfan::ZCone*)u->Data(); |
---|
1175 | gfan::ZCone* zc2 = (gfan::ZCone*)v->Data(); |
---|
1176 | int d1 = zc1->ambientDimension(); |
---|
1177 | int d2 = zc2->ambientDimension(); |
---|
1178 | if (d1 != d2) |
---|
1179 | { |
---|
1180 | Werror("expected ambient dims of both cones to coincide\n" |
---|
1181 | "but got %d and %d", d1, d2); |
---|
1182 | return TRUE; |
---|
1183 | } |
---|
1184 | gfan::ZCone zc3 = gfan::intersection(*zc1, *zc2); |
---|
1185 | zc3.canonicalize(); |
---|
1186 | res->rtyp = coneID; |
---|
1187 | res->data = (void *)new gfan::ZCone(zc3); |
---|
1188 | return FALSE; |
---|
1189 | } |
---|
1190 | if ((v != NULL) && (v->Typ() == polytopeID)) |
---|
1191 | { |
---|
1192 | gfan::ZCone* zc11 = (gfan::ZCone*)u->Data(); |
---|
1193 | gfan::ZCone zc1 = liftUp(*zc11); |
---|
1194 | gfan::ZCone* zc2 = (gfan::ZCone*)v->Data(); |
---|
1195 | int d1 = zc1.ambientDimension(); |
---|
1196 | int d2 = zc2->ambientDimension(); |
---|
1197 | if (d1 != d2) |
---|
1198 | { |
---|
1199 | Werror("expected ambient dims of both cones to coincide\n" |
---|
1200 | "but got %d and %d", d1, d2); |
---|
1201 | return TRUE; |
---|
1202 | } |
---|
1203 | gfan::ZCone zc3 = gfan::intersection(zc1, *zc2); |
---|
1204 | zc3.canonicalize(); |
---|
1205 | res->rtyp = polytopeID; |
---|
1206 | res->data = (void *)new gfan::ZCone(zc3); |
---|
1207 | return FALSE; |
---|
1208 | } |
---|
1209 | } |
---|
1210 | if ((u != NULL) && (u->Typ() == polytopeID)) |
---|
1211 | { |
---|
1212 | leftv v = u->next; |
---|
1213 | if ((v != NULL) && (v->Typ() == coneID)) |
---|
1214 | { |
---|
1215 | gfan::ZCone* zc1 = (gfan::ZCone*)u->Data(); |
---|
1216 | gfan::ZCone* zc22 = (gfan::ZCone*)v->Data(); |
---|
1217 | gfan::ZCone zc2 = liftUp(*zc22); |
---|
1218 | int d1 = zc1->ambientDimension(); |
---|
1219 | int d2 = zc2.ambientDimension(); |
---|
1220 | if (d1 != d2) |
---|
1221 | { |
---|
1222 | Werror("expected ambient dims of both cones to coincide\n" |
---|
1223 | "but got %d and %d", d1, d2); |
---|
1224 | return TRUE; |
---|
1225 | } |
---|
1226 | gfan::ZCone zc3 = gfan::intersection(*zc1, zc2); |
---|
1227 | zc3.canonicalize(); |
---|
1228 | res->rtyp = polytopeID; |
---|
1229 | res->data = (void *)new gfan::ZCone(zc3); |
---|
1230 | return FALSE; |
---|
1231 | } |
---|
1232 | if ((v != NULL) && (v->Typ() == polytopeID)) |
---|
1233 | { |
---|
1234 | gfan::ZCone* zc1 = (gfan::ZCone*)u->Data(); |
---|
1235 | gfan::ZCone* zc2 = (gfan::ZCone*)v->Data(); |
---|
1236 | int d1 = zc1->ambientDimension(); |
---|
1237 | int d2 = zc2->ambientDimension(); |
---|
1238 | if (d1 != d2) |
---|
1239 | { |
---|
1240 | Werror("expected ambient dims of both cones to coincide\n" |
---|
1241 | "but got %d and %d", d1, d2); |
---|
1242 | return TRUE; |
---|
1243 | } |
---|
1244 | gfan::ZCone zc3 = gfan::intersection(*zc1, *zc2); |
---|
1245 | zc3.canonicalize(); |
---|
1246 | res->rtyp = polytopeID; |
---|
1247 | res->data = (void *)new gfan::ZCone(zc3); |
---|
1248 | return FALSE; |
---|
1249 | } |
---|
1250 | } |
---|
1251 | WerrorS("convexIntersection: unexpected parameters"); |
---|
1252 | return TRUE; |
---|
1253 | } |
---|
1254 | |
---|
1255 | BOOLEAN convexHull(leftv res, leftv args) |
---|
1256 | { |
---|
1257 | leftv u = args; |
---|
1258 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
1259 | { |
---|
1260 | leftv v = u->next; |
---|
1261 | if ((v != NULL) && (v->Typ() == coneID)) |
---|
1262 | { |
---|
1263 | gfan::ZCone* zc1 = (gfan::ZCone*)u->Data(); |
---|
1264 | gfan::ZCone* zc2 = (gfan::ZCone*)v->Data(); |
---|
1265 | int d1 = zc1->ambientDimension(); |
---|
1266 | int d2 = zc2->ambientDimension(); |
---|
1267 | if (d1 != d2) |
---|
1268 | { |
---|
1269 | Werror("expected ambient dims of both cones to coincide\n" |
---|
1270 | "but got %d and %d", d1, d2); |
---|
1271 | return TRUE; |
---|
1272 | } |
---|
1273 | gfan::ZMatrix zm1 = zc1->extremeRays(); |
---|
1274 | gfan::ZMatrix zm2 = zc2->extremeRays(); |
---|
1275 | gfan::ZMatrix zn1 = zc1->generatorsOfLinealitySpace(); |
---|
1276 | gfan::ZMatrix zn2 = zc2->generatorsOfLinealitySpace(); |
---|
1277 | gfan::ZMatrix zm = combineOnTop(zm1,zm2); |
---|
1278 | gfan::ZMatrix zn = combineOnTop(zn1,zn2); |
---|
1279 | gfan::ZCone* zc = new gfan::ZCone(); |
---|
1280 | *zc = gfan::ZCone::givenByRays(zm, zn); |
---|
1281 | res->rtyp = coneID; |
---|
1282 | res->data = (void*) zc; |
---|
1283 | return FALSE; |
---|
1284 | } |
---|
1285 | if ((v != NULL) && (v->Typ() == polytopeID)) |
---|
1286 | { |
---|
1287 | gfan::ZCone* zc11 = (gfan::ZCone*)u->Data(); |
---|
1288 | gfan::ZCone zc1 = liftUp(*zc11); |
---|
1289 | gfan::ZCone* zc2 = (gfan::ZCone*)v->Data(); |
---|
1290 | int d1 = zc1.ambientDimension()-1; |
---|
1291 | int d2 = zc2->ambientDimension()-1; |
---|
1292 | if (d1 != d2) |
---|
1293 | { |
---|
1294 | Werror("expected ambient dims of both cones to coincide\n" |
---|
1295 | "but got %d and %d", d1, d2); |
---|
1296 | return TRUE; |
---|
1297 | } |
---|
1298 | gfan::ZMatrix zm1 = zc1.extremeRays(); |
---|
1299 | gfan::ZMatrix zm2 = zc2->extremeRays(); |
---|
1300 | gfan::ZMatrix zn = zc1.generatorsOfLinealitySpace(); |
---|
1301 | gfan::ZMatrix zm = combineOnTop(zm1,zm2); |
---|
1302 | gfan::ZCone* zc = new gfan::ZCone(); |
---|
1303 | *zc = gfan::ZCone::givenByRays(zm, zn); |
---|
1304 | res->rtyp = polytopeID; |
---|
1305 | res->data = (void*) zc; |
---|
1306 | return FALSE; |
---|
1307 | } |
---|
1308 | } |
---|
1309 | if ((u != NULL) && (u->Typ() == polytopeID)) |
---|
1310 | { |
---|
1311 | leftv v = u->next; |
---|
1312 | if ((v != NULL) && (v->Typ() == coneID)) |
---|
1313 | { |
---|
1314 | gfan::ZCone* zc1 = (gfan::ZCone*)u->Data(); |
---|
1315 | gfan::ZCone* zc22 = (gfan::ZCone*)v->Data(); |
---|
1316 | gfan::ZCone zc2 = liftUp(*zc22); |
---|
1317 | int d1 = zc1->ambientDimension()-1; |
---|
1318 | int d2 = zc2.ambientDimension()-1; |
---|
1319 | if (d1 != d2) |
---|
1320 | { |
---|
1321 | Werror("expected ambient dims of both cones to coincide\n" |
---|
1322 | "but got %d and %d", d1, d2); |
---|
1323 | return TRUE; |
---|
1324 | } |
---|
1325 | gfan::ZMatrix zm1 = zc1->extremeRays(); |
---|
1326 | gfan::ZMatrix zm2 = zc2.extremeRays(); |
---|
1327 | gfan::ZMatrix zn = zc2.generatorsOfLinealitySpace(); |
---|
1328 | gfan::ZMatrix zm = combineOnTop(zm1,zm2); |
---|
1329 | gfan::ZCone* zc = new gfan::ZCone(); |
---|
1330 | *zc = gfan::ZCone::givenByRays(zm,gfan::ZMatrix(0, zm.getWidth())); |
---|
1331 | res->rtyp = polytopeID; |
---|
1332 | res->data = (void*) zc; |
---|
1333 | return FALSE; |
---|
1334 | } |
---|
1335 | if ((v != NULL) && (v->Typ() == polytopeID)) |
---|
1336 | { |
---|
1337 | gfan::ZCone* zc1 = (gfan::ZCone*)u->Data(); |
---|
1338 | gfan::ZCone* zc2 = (gfan::ZCone*)v->Data(); |
---|
1339 | int d1 = zc1->ambientDimension()-1; |
---|
1340 | int d2 = zc2->ambientDimension()-1; |
---|
1341 | if (d1 != d2) |
---|
1342 | { |
---|
1343 | Werror("expected ambient dims of both cones to coincide\n" |
---|
1344 | "but got %d and %d", d1, d2); |
---|
1345 | return TRUE; |
---|
1346 | } |
---|
1347 | gfan::ZMatrix zm1 = zc1->extremeRays(); |
---|
1348 | gfan::ZMatrix zm2 = zc2->extremeRays(); |
---|
1349 | gfan::ZMatrix zm = combineOnTop(zm1,zm2); |
---|
1350 | gfan::ZCone* zc = new gfan::ZCone(); |
---|
1351 | *zc = gfan::ZCone::givenByRays(zm,gfan::ZMatrix(0, zm.getWidth())); |
---|
1352 | res->rtyp = polytopeID; |
---|
1353 | res->data = (void*) zc; |
---|
1354 | return FALSE; |
---|
1355 | } |
---|
1356 | } |
---|
1357 | WerrorS("convexHull: unexpected parameters"); |
---|
1358 | return TRUE; |
---|
1359 | } |
---|
1360 | |
---|
1361 | BOOLEAN coneLink(leftv res, leftv args) |
---|
1362 | { |
---|
1363 | leftv u = args; |
---|
1364 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
1365 | { |
---|
1366 | leftv v = u->next; |
---|
1367 | if ((v != NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTVEC_CMD))) |
---|
1368 | { |
---|
1369 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
1370 | bigintmat* iv = NULL; |
---|
1371 | if (v->Typ() == INTVEC_CMD) |
---|
1372 | { |
---|
1373 | intvec* iv0 = (intvec*) v->Data(); |
---|
1374 | iv = iv2bim(iv0,coeffs_BIGINT)->transpose(); |
---|
1375 | } |
---|
1376 | else |
---|
1377 | iv = (bigintmat*)v->Data(); |
---|
1378 | gfan::ZVector* zv = bigintmatToZVector(iv); |
---|
1379 | int d1 = zc->ambientDimension(); |
---|
1380 | int d2 = zv->size(); |
---|
1381 | if (d1 != d2) |
---|
1382 | { |
---|
1383 | Werror("expected ambient dim of cone and size of vector\n" |
---|
1384 | " to be equal but got %d and %d", d1, d2); |
---|
1385 | return TRUE; |
---|
1386 | } |
---|
1387 | if(!zc->contains(*zv)) |
---|
1388 | { |
---|
1389 | WerrorS("the provided intvec does not lie in the cone"); |
---|
1390 | return TRUE; |
---|
1391 | } |
---|
1392 | gfan::ZCone* zd = new gfan::ZCone(zc->link(*zv)); |
---|
1393 | res->rtyp = coneID; |
---|
1394 | res->data = (void *) zd; |
---|
1395 | |
---|
1396 | delete zv; |
---|
1397 | if (v->Typ() == INTMAT_CMD) |
---|
1398 | delete iv; |
---|
1399 | return FALSE; |
---|
1400 | } |
---|
1401 | } |
---|
1402 | WerrorS("coneLink: unexpected parameters"); |
---|
1403 | return TRUE; |
---|
1404 | } |
---|
1405 | |
---|
1406 | BOOLEAN containsInSupport(leftv res, leftv args) |
---|
1407 | { |
---|
1408 | leftv u=args; |
---|
1409 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
1410 | { |
---|
1411 | leftv v=u->next; |
---|
1412 | if ((v != NULL) && (v->Typ() == coneID)) |
---|
1413 | { |
---|
1414 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
1415 | gfan::ZCone* zd = (gfan::ZCone*)v->Data(); |
---|
1416 | int d1 = zc->ambientDimension(); |
---|
1417 | int d2 = zd->ambientDimension(); |
---|
1418 | if (d1 != d2) |
---|
1419 | { |
---|
1420 | Werror("expected cones with same ambient dimensions\n but got" |
---|
1421 | " dimensions %d and %d", d1, d2); |
---|
1422 | return TRUE; |
---|
1423 | } |
---|
1424 | bool b = (zc->contains(*zd) ? 1 : 0); |
---|
1425 | res->rtyp = INT_CMD; |
---|
1426 | res->data = (void*) (long) b; |
---|
1427 | return FALSE; |
---|
1428 | } |
---|
1429 | if ((v != NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTVEC_CMD))) |
---|
1430 | { |
---|
1431 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
1432 | bigintmat* iv = NULL; |
---|
1433 | if (v->Typ() == INTVEC_CMD) |
---|
1434 | { |
---|
1435 | intvec* iv0 = (intvec*) v->Data(); |
---|
1436 | iv = iv2bim(iv0,coeffs_BIGINT)->transpose(); |
---|
1437 | } |
---|
1438 | else |
---|
1439 | iv = (bigintmat*)v->Data(); |
---|
1440 | |
---|
1441 | gfan::ZVector* zv = bigintmatToZVector(iv); |
---|
1442 | int d1 = zc->ambientDimension(); |
---|
1443 | int d2 = zv->size(); |
---|
1444 | if (d1 != d2) |
---|
1445 | { |
---|
1446 | Werror("expected cones with same ambient dimensions\n but got" |
---|
1447 | " dimensions %d and %d", d1, d2); |
---|
1448 | return TRUE; |
---|
1449 | } |
---|
1450 | int b = zc->contains(*zv); |
---|
1451 | res->rtyp = INT_CMD; |
---|
1452 | res->data = (void*) (long) b; |
---|
1453 | |
---|
1454 | delete zv; |
---|
1455 | if (v->Typ() == INTMAT_CMD) |
---|
1456 | delete iv; |
---|
1457 | return FALSE; |
---|
1458 | } |
---|
1459 | } |
---|
1460 | WerrorS("containsInSupport: unexpected parameters"); |
---|
1461 | return TRUE; |
---|
1462 | } |
---|
1463 | |
---|
1464 | BOOLEAN containsRelatively(leftv res, leftv args) |
---|
1465 | { |
---|
1466 | leftv u = args; |
---|
1467 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
1468 | { |
---|
1469 | leftv v = u->next; |
---|
1470 | if ((v != NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTVEC_CMD))) |
---|
1471 | { |
---|
1472 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
1473 | bigintmat* iv = NULL; |
---|
1474 | if (v->Typ() == INTVEC_CMD) |
---|
1475 | { |
---|
1476 | intvec* iv0 = (intvec*) v->Data(); |
---|
1477 | iv = iv2bim(iv0,coeffs_BIGINT)->transpose(); |
---|
1478 | } |
---|
1479 | else |
---|
1480 | iv = (bigintmat*)v->Data(); |
---|
1481 | gfan::ZVector* zv = bigintmatToZVector(iv); |
---|
1482 | int d1 = zc->ambientDimension(); |
---|
1483 | int d2 = zv->size(); |
---|
1484 | if (d1 == d2) |
---|
1485 | { |
---|
1486 | bool b = (zc->containsRelatively(*zv) ? 1 : 0); |
---|
1487 | res->rtyp = INT_CMD; |
---|
1488 | res->data = (void *) b; |
---|
1489 | delete zv; |
---|
1490 | if (v->Typ() == INTMAT_CMD) |
---|
1491 | delete iv; |
---|
1492 | return FALSE; |
---|
1493 | } |
---|
1494 | delete zv; |
---|
1495 | if (v->Typ() == INTMAT_CMD) |
---|
1496 | delete iv; |
---|
1497 | Werror("expected ambient dim of cone and size of vector\n" |
---|
1498 | "to be equal but got %d and %d", d1, d2); |
---|
1499 | } |
---|
1500 | } |
---|
1501 | WerrorS("containsRelatively: unexpected parameters"); |
---|
1502 | return TRUE; |
---|
1503 | } |
---|
1504 | |
---|
1505 | BOOLEAN hasFace(leftv res, leftv args) |
---|
1506 | { |
---|
1507 | leftv u=args; |
---|
1508 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
1509 | { |
---|
1510 | leftv v=u->next; |
---|
1511 | if ((v != NULL) && (v->Typ() == coneID)) |
---|
1512 | { |
---|
1513 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
1514 | gfan::ZCone* zd = (gfan::ZCone*)v->Data(); |
---|
1515 | bool b = zc->hasFace(*zd); |
---|
1516 | res->rtyp = INT_CMD; |
---|
1517 | res->data = (void*) (long) b; |
---|
1518 | return FALSE; |
---|
1519 | } |
---|
1520 | } |
---|
1521 | if ((u != NULL) && (u->Typ() == polytopeID)) |
---|
1522 | { |
---|
1523 | leftv v=u->next; |
---|
1524 | if ((v != NULL) && (v->Typ() == polytopeID)) |
---|
1525 | { |
---|
1526 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
1527 | gfan::ZCone* zd = (gfan::ZCone*)v->Data(); |
---|
1528 | bool b = zc->hasFace(*zd); |
---|
1529 | res->rtyp = INT_CMD; |
---|
1530 | res->data = (void*) (long) b; |
---|
1531 | return FALSE; |
---|
1532 | } |
---|
1533 | } |
---|
1534 | WerrorS("containsAsFace: unexpected parameters"); |
---|
1535 | return TRUE; |
---|
1536 | } |
---|
1537 | |
---|
1538 | BOOLEAN canonicalizeCone(leftv res, leftv args) |
---|
1539 | { |
---|
1540 | leftv u=args; |
---|
1541 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
1542 | { |
---|
1543 | gfan::ZCone* zc = (gfan::ZCone*)u->Data(); |
---|
1544 | gfan::ZCone* zd = new gfan::ZCone(*zc); |
---|
1545 | zd->canonicalize(); |
---|
1546 | res->rtyp = coneID; |
---|
1547 | res->data = (void*) zd; |
---|
1548 | return FALSE; |
---|
1549 | } |
---|
1550 | WerrorS("canonicalizeCone: unexpected parameters"); |
---|
1551 | return TRUE; |
---|
1552 | } |
---|
1553 | |
---|
1554 | BOOLEAN containsCone(leftv res, leftv args) |
---|
1555 | { |
---|
1556 | leftv u=args; |
---|
1557 | if ((u != NULL) && (u->Typ() == LIST_CMD)) |
---|
1558 | { |
---|
1559 | leftv v=u->next; |
---|
1560 | if ((v != NULL) && (v->Typ() == coneID)) |
---|
1561 | { |
---|
1562 | lists l = (lists) u->Data(); |
---|
1563 | gfan::ZCone* zc = (gfan::ZCone*) v->Data(); |
---|
1564 | zc->canonicalize(); |
---|
1565 | int b = 0; |
---|
1566 | for (int i=0; i<=lSize(l); i++) |
---|
1567 | { |
---|
1568 | if (l->m[i].Typ() != coneID) |
---|
1569 | { |
---|
1570 | WerrorS("containsCone: entries of wrong type in list"); |
---|
1571 | return TRUE; |
---|
1572 | } |
---|
1573 | gfan::ZCone* ll = (gfan::ZCone*) l->m[i].Data(); |
---|
1574 | ll->canonicalize(); |
---|
1575 | if (!((*ll) != (*zc))) |
---|
1576 | { |
---|
1577 | b = 1; |
---|
1578 | break; |
---|
1579 | } |
---|
1580 | } |
---|
1581 | res->rtyp = INT_CMD; |
---|
1582 | res->data = (char*) (long) b; |
---|
1583 | return FALSE; |
---|
1584 | } |
---|
1585 | } |
---|
1586 | WerrorS("containsCone: unexpected parameters"); |
---|
1587 | return TRUE; |
---|
1588 | } |
---|
1589 | |
---|
1590 | gfan::ZVector intStar2ZVector(const int d, const int* i) |
---|
1591 | { |
---|
1592 | gfan::ZVector zv(d); |
---|
1593 | for(int j=0; j<d; j++) |
---|
1594 | zv[j]=i[j+1]; |
---|
1595 | return zv; |
---|
1596 | } |
---|
1597 | |
---|
1598 | BOOLEAN maximalGroebnerCone(leftv res, leftv args) |
---|
1599 | { |
---|
1600 | leftv u = args; |
---|
1601 | if ((u != NULL) && (u->Typ() == IDEAL_CMD)) |
---|
1602 | { |
---|
1603 | leftv v = u->next; |
---|
1604 | if (v == NULL) |
---|
1605 | { |
---|
1606 | int n = currRing->N; |
---|
1607 | ideal I = (ideal) u->Data(); |
---|
1608 | poly g = NULL; |
---|
1609 | int* leadexpv = (int*) omAlloc((n+1)*sizeof(int)); |
---|
1610 | int* tailexpv = (int*) omAlloc((n+1)*sizeof(int)); |
---|
1611 | gfan::ZVector leadexpw = gfan::ZVector(n); |
---|
1612 | gfan::ZVector tailexpw = gfan::ZVector(n); |
---|
1613 | gfan::ZMatrix inequalities = gfan::ZMatrix(0,n); |
---|
1614 | for (int i=0; i<IDELEMS(I); i++) |
---|
1615 | { |
---|
1616 | g = (poly) I->m[i]; pGetExpV(g,leadexpv); |
---|
1617 | leadexpw = intStar2ZVector(n, leadexpv); |
---|
1618 | pIter(g); |
---|
1619 | while (g != NULL) |
---|
1620 | { |
---|
1621 | pGetExpV(g,tailexpv); |
---|
1622 | tailexpw = intStar2ZVector(n, tailexpv); |
---|
1623 | inequalities.appendRow(leadexpw-tailexpw); |
---|
1624 | pIter(g); |
---|
1625 | } |
---|
1626 | } |
---|
1627 | gfan::ZCone* gCone = new gfan::ZCone(inequalities,gfan::ZMatrix(0, inequalities.getWidth())); |
---|
1628 | omFreeSize(leadexpv,(n+1)*sizeof(int)); |
---|
1629 | omFreeSize(tailexpv,(n+1)*sizeof(int)); |
---|
1630 | |
---|
1631 | res->rtyp = coneID; |
---|
1632 | res->data = (void*) gCone; |
---|
1633 | return FALSE; |
---|
1634 | } |
---|
1635 | } |
---|
1636 | WerrorS("maximalGroebnerCone: unexpected parameters"); |
---|
1637 | return TRUE; |
---|
1638 | } |
---|
1639 | |
---|
1640 | |
---|
1641 | lists listOfFacets(const gfan::ZCone &zc) |
---|
1642 | { |
---|
1643 | gfan::ZMatrix inequalities = zc.getFacets(); |
---|
1644 | gfan::ZMatrix equations = zc.getImpliedEquations(); |
---|
1645 | lists L = (lists)omAllocBin(slists_bin); |
---|
1646 | int r = inequalities.getHeight(); |
---|
1647 | int c = inequalities.getWidth(); |
---|
1648 | L->Init(r); |
---|
1649 | |
---|
1650 | /* next we iterate over each of the r facets, build the respective cone and add it to the list */ |
---|
1651 | /* this is the i=0 case */ |
---|
1652 | gfan::ZMatrix newInequalities = inequalities.submatrix(1,0,r,c); |
---|
1653 | gfan::ZMatrix newEquations = equations; |
---|
1654 | newEquations.appendRow(inequalities[0]); |
---|
1655 | L->m[0].rtyp = coneID; L->m[0].data=(void*) new gfan::ZCone(newInequalities,newEquations); |
---|
1656 | |
---|
1657 | /* these are the cases i=1,...,r-2 */ |
---|
1658 | for (int i=1; i<r-1; i++) |
---|
1659 | { |
---|
1660 | newInequalities = inequalities.submatrix(0,0,i-1,c); |
---|
1661 | newInequalities.append(inequalities.submatrix(i+1,0,r,c)); |
---|
1662 | newEquations = equations; |
---|
1663 | newEquations.appendRow(inequalities[i]); |
---|
1664 | L->m[i].rtyp = coneID; L->m[i].data=(void*) new gfan::ZCone(newInequalities,newEquations); |
---|
1665 | } |
---|
1666 | |
---|
1667 | /* this is the i=r-1 case */ |
---|
1668 | newInequalities = inequalities.submatrix(0,0,r-1,c); |
---|
1669 | newEquations = equations; |
---|
1670 | newEquations.appendRow(inequalities[r]); |
---|
1671 | L->m[r-1].rtyp = coneID; L->m[r-1].data=(void*) new gfan::ZCone(newInequalities,newEquations); |
---|
1672 | |
---|
1673 | return L; |
---|
1674 | } |
---|
1675 | |
---|
1676 | |
---|
1677 | BOOLEAN listOfFacets(leftv res, leftv args) |
---|
1678 | { |
---|
1679 | leftv u=args; |
---|
1680 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
1681 | { |
---|
1682 | gfan::ZCone* zc = (gfan::ZCone*) u->Data(); |
---|
1683 | lists L = listOfFacets(*zc); |
---|
1684 | res->rtyp = LIST_CMD; |
---|
1685 | res->data = (void*) L; |
---|
1686 | return FALSE; |
---|
1687 | } |
---|
1688 | WerrorS("listOfFacets: unexpected parameters"); |
---|
1689 | return TRUE; |
---|
1690 | } |
---|
1691 | |
---|
1692 | |
---|
1693 | poly initial(poly p) |
---|
1694 | { |
---|
1695 | poly g = p; |
---|
1696 | poly h = p_Head(g,currRing); |
---|
1697 | poly f = h; |
---|
1698 | long d = p_Deg(g,currRing); |
---|
1699 | pIter(g); |
---|
1700 | while ((g != NULL) && (p_Deg(g,currRing) == d)) |
---|
1701 | { |
---|
1702 | pNext(h) = p_Head(g,currRing); |
---|
1703 | pIter(h); |
---|
1704 | pIter(g); |
---|
1705 | } |
---|
1706 | return(f); |
---|
1707 | } |
---|
1708 | |
---|
1709 | |
---|
1710 | BOOLEAN initial(leftv res, leftv args) |
---|
1711 | { |
---|
1712 | leftv u = args; |
---|
1713 | if ((u != NULL) && (u->Typ() == POLY_CMD)) |
---|
1714 | { |
---|
1715 | leftv v = u->next; |
---|
1716 | if (v == NULL) |
---|
1717 | { |
---|
1718 | poly p = (poly) u->Data(); |
---|
1719 | res->rtyp = POLY_CMD; |
---|
1720 | res->data = (void*) initial(p); |
---|
1721 | return FALSE; |
---|
1722 | } |
---|
1723 | } |
---|
1724 | if ((u != NULL) && (u->Typ() == IDEAL_CMD)) |
---|
1725 | { |
---|
1726 | leftv v = u->next; |
---|
1727 | if (v == NULL) |
---|
1728 | { |
---|
1729 | ideal I = (ideal) u->Data(); |
---|
1730 | ideal inI = idInit(IDELEMS(I)); |
---|
1731 | poly g; |
---|
1732 | for (int i=0; i<IDELEMS(I); i++) |
---|
1733 | { |
---|
1734 | g = (poly) I->m[i]; |
---|
1735 | inI->m[i]=initial(g); |
---|
1736 | } |
---|
1737 | res->rtyp = IDEAL_CMD; |
---|
1738 | res->data = (void*) inI; |
---|
1739 | return FALSE; |
---|
1740 | } |
---|
1741 | } |
---|
1742 | WerrorS("initial: unexpected parameters"); |
---|
1743 | return TRUE; |
---|
1744 | } |
---|
1745 | |
---|
1746 | |
---|
1747 | BOOLEAN homogeneitySpace(leftv res, leftv args) |
---|
1748 | { |
---|
1749 | leftv u = args; |
---|
1750 | if ((u != NULL) && (u->Typ() == IDEAL_CMD)) |
---|
1751 | { |
---|
1752 | leftv v = u->next; |
---|
1753 | if (v == NULL) |
---|
1754 | { |
---|
1755 | int n = currRing->N; |
---|
1756 | ideal I = (ideal) u->Data(); |
---|
1757 | poly g; |
---|
1758 | int* leadexpv = (int*) omAlloc((n+1)*sizeof(int)); |
---|
1759 | int* tailexpv = (int*) omAlloc((n+1)*sizeof(int)); |
---|
1760 | gfan::ZVector leadexpw = gfan::ZVector(n); |
---|
1761 | gfan::ZVector tailexpw = gfan::ZVector(n); |
---|
1762 | gfan::ZMatrix equations = gfan::ZMatrix(0,n); |
---|
1763 | for (int i=0; i<IDELEMS(I); i++) |
---|
1764 | { |
---|
1765 | g = (poly) I->m[i]; pGetExpV(g,leadexpv); |
---|
1766 | leadexpw = intStar2ZVector(n, leadexpv); |
---|
1767 | pIter(g); |
---|
1768 | while (g != NULL) |
---|
1769 | { |
---|
1770 | pGetExpV(g,tailexpv); |
---|
1771 | tailexpw = intStar2ZVector(n, tailexpv); |
---|
1772 | equations.appendRow(leadexpw-tailexpw); |
---|
1773 | pIter(g); |
---|
1774 | } |
---|
1775 | } |
---|
1776 | gfan::ZCone* gCone = new gfan::ZCone(gfan::ZMatrix(0, equations.getWidth()),equations); |
---|
1777 | omFreeSize(leadexpv,(n+1)*sizeof(int)); |
---|
1778 | omFreeSize(tailexpv,(n+1)*sizeof(int)); |
---|
1779 | |
---|
1780 | res->rtyp = coneID; |
---|
1781 | res->data = (void*) gCone; |
---|
1782 | return FALSE; |
---|
1783 | } |
---|
1784 | } |
---|
1785 | WerrorS("homogeneitySpace: unexpected parameters"); |
---|
1786 | return TRUE; |
---|
1787 | } |
---|
1788 | |
---|
1789 | |
---|
1790 | BOOLEAN groebnerCone(leftv res, leftv args) |
---|
1791 | { |
---|
1792 | leftv u = args; |
---|
1793 | if ((u != NULL) && (u->Typ() == IDEAL_CMD)) |
---|
1794 | { |
---|
1795 | leftv v = u->next; |
---|
1796 | if (v == NULL) |
---|
1797 | { |
---|
1798 | int n = currRing->N; |
---|
1799 | ideal I = (ideal) u->Data(); |
---|
1800 | poly g = NULL; |
---|
1801 | int* leadexpv = (int*) omAlloc((n+1)*sizeof(int)); |
---|
1802 | int* tailexpv = (int*) omAlloc((n+1)*sizeof(int)); |
---|
1803 | gfan::ZVector leadexpw = gfan::ZVector(n); |
---|
1804 | gfan::ZVector tailexpw = gfan::ZVector(n); |
---|
1805 | gfan::ZMatrix inequalities = gfan::ZMatrix(0,n); |
---|
1806 | gfan::ZMatrix equations = gfan::ZMatrix(0,n); |
---|
1807 | long d; |
---|
1808 | for (int i=0; i<IDELEMS(I); i++) |
---|
1809 | { |
---|
1810 | g = (poly) I->m[i]; pGetExpV(g,leadexpv); |
---|
1811 | leadexpw = intStar2ZVector(n, leadexpv); |
---|
1812 | pIter(g); |
---|
1813 | d = p_Deg(g,currRing); |
---|
1814 | while ((g != NULL) && (p_Deg(g,currRing) == d)) |
---|
1815 | { |
---|
1816 | pGetExpV(g,tailexpv); |
---|
1817 | tailexpw = intStar2ZVector(n, tailexpv); |
---|
1818 | equations.appendRow(leadexpw-tailexpw); |
---|
1819 | pIter(g); |
---|
1820 | } |
---|
1821 | |
---|
1822 | if (g != NULL) |
---|
1823 | { |
---|
1824 | while (g != NULL) |
---|
1825 | { |
---|
1826 | pGetExpV(g,tailexpv); |
---|
1827 | tailexpw = intStar2ZVector(n, tailexpv); |
---|
1828 | inequalities.appendRow(leadexpw-tailexpw); |
---|
1829 | pIter(g); |
---|
1830 | } |
---|
1831 | } |
---|
1832 | } |
---|
1833 | gfan::ZCone* gCone = new gfan::ZCone(inequalities,equations); |
---|
1834 | omFreeSize(leadexpv,(n+1)*sizeof(int)); |
---|
1835 | omFreeSize(tailexpv,(n+1)*sizeof(int)); |
---|
1836 | |
---|
1837 | res->rtyp = coneID; |
---|
1838 | res->data = (void*) gCone; |
---|
1839 | return FALSE; |
---|
1840 | } |
---|
1841 | } |
---|
1842 | WerrorS("groebnerCone: unexpected parameters"); |
---|
1843 | return TRUE; |
---|
1844 | } |
---|
1845 | |
---|
1846 | /*** |
---|
1847 | * Given a cone and a point in its boundary, |
---|
1848 | * returns the inner normal vector of a facet |
---|
1849 | * containing the point. |
---|
1850 | * In case no facet contains the point, |
---|
1851 | * then 0 is returned. |
---|
1852 | **/ |
---|
1853 | gfan::ZVector* facetContaining(gfan::ZCone* zc, gfan::ZVector* zv) |
---|
1854 | { |
---|
1855 | gfan::ZMatrix facets = zc->getFacets(); |
---|
1856 | for (int i=0; i<facets.getHeight(); i++) |
---|
1857 | { |
---|
1858 | gfan::ZVector facet = facets[i]; |
---|
1859 | if (dot(facet,*zv) == (long) 0) |
---|
1860 | return new gfan::ZVector(facet); |
---|
1861 | } |
---|
1862 | return new gfan::ZVector(zc->ambientDimension()); |
---|
1863 | } |
---|
1864 | |
---|
1865 | |
---|
1866 | BOOLEAN facetContaining(leftv res, leftv args) |
---|
1867 | { |
---|
1868 | leftv u = args; |
---|
1869 | if ((u != NULL) && (u->Typ() == coneID)) |
---|
1870 | { |
---|
1871 | leftv v = u->next; |
---|
1872 | if ((v != NULL) && ((v->Typ() == BIGINTMAT_CMD) || (v->Typ() == INTVEC_CMD))) |
---|
1873 | { |
---|
1874 | gfan::ZCone* zc = (gfan::ZCone*) u->Data(); |
---|
1875 | |
---|
1876 | bigintmat* point1; |
---|
1877 | if (v->Typ() == INTVEC_CMD) |
---|
1878 | { |
---|
1879 | intvec* point0 = (intvec*) v->Data(); |
---|
1880 | point1 = iv2bim(point0,coeffs_BIGINT)->transpose(); |
---|
1881 | } |
---|
1882 | else |
---|
1883 | point1 = (bigintmat*) v->Data(); |
---|
1884 | |
---|
1885 | gfan::ZVector* point = bigintmatToZVector(*point1); |
---|
1886 | gfan::ZVector* facet = facetContaining(zc, point); |
---|
1887 | |
---|
1888 | res->rtyp = BIGINTMAT_CMD; |
---|
1889 | res->data = (void*) zVectorToBigintmat(*facet); |
---|
1890 | |
---|
1891 | delete facet; |
---|
1892 | delete point; |
---|
1893 | if (v->Typ() == INTVEC_CMD) |
---|
1894 | delete point1; |
---|
1895 | return FALSE; |
---|
1896 | } |
---|
1897 | } |
---|
1898 | WerrorS("facetContaining: unexpected parameters"); |
---|
1899 | return TRUE; |
---|
1900 | } |
---|
1901 | |
---|
1902 | |
---|
1903 | void bbcone_setup(SModulFunctions* p) |
---|
1904 | { |
---|
1905 | blackbox *b=(blackbox*)omAlloc0(sizeof(blackbox)); |
---|
1906 | // all undefined entries will be set to default in setBlackboxStuff |
---|
1907 | // the default Print is quite usefull, |
---|
1908 | // all other are simply error messages |
---|
1909 | b->blackbox_destroy=bbcone_destroy; |
---|
1910 | b->blackbox_String=bbcone_String; |
---|
1911 | // b->blackbox_Print=blackbox_default_Print; |
---|
1912 | b->blackbox_Init=bbcone_Init; |
---|
1913 | b->blackbox_Copy=bbcone_Copy; |
---|
1914 | b->blackbox_Assign=bbcone_Assign; |
---|
1915 | b->blackbox_Op2=bbcone_Op2; |
---|
1916 | p->iiAddCproc("","coneViaInequalities",FALSE,coneViaNormals); |
---|
1917 | p->iiAddCproc("","coneViaPoints",FALSE,coneViaRays); |
---|
1918 | |
---|
1919 | // iiAddCproc("","makePolytope",FALSE,coneToPolytope); |
---|
1920 | p->iiAddCproc("","ambientDimension",FALSE,ambientDimension); |
---|
1921 | p->iiAddCproc("","canonicalizeCone",FALSE,canonicalizeCone); |
---|
1922 | p->iiAddCproc("","codimension",FALSE,codimension); |
---|
1923 | p->iiAddCproc("","coneLink",FALSE,coneLink); |
---|
1924 | p->iiAddCproc("","containsAsFace",FALSE,hasFace); |
---|
1925 | p->iiAddCproc("","containsInSupport",FALSE,containsInSupport); |
---|
1926 | p->iiAddCproc("","containsPositiveVector",FALSE,containsPositiveVector); |
---|
1927 | p->iiAddCproc("","containsRelatively",FALSE,containsRelatively); |
---|
1928 | p->iiAddCproc("","convexHull",FALSE,convexHull); |
---|
1929 | p->iiAddCproc("","convexIntersection",FALSE,intersectCones); |
---|
1930 | p->iiAddCproc("","dimension",FALSE,dimension); |
---|
1931 | p->iiAddCproc("","dualCone",FALSE,dualCone); |
---|
1932 | p->iiAddCproc("","equations",FALSE,equations); |
---|
1933 | p->iiAddCproc("","facets",FALSE,facets); |
---|
1934 | p->iiAddCproc("","generatorsOfLinealitySpace",FALSE,generatorsOfLinealitySpace); |
---|
1935 | p->iiAddCproc("","generatorsOfSpan",FALSE,generatorsOfSpan); |
---|
1936 | p->iiAddCproc("","getLinearForms",FALSE,getLinearForms); |
---|
1937 | p->iiAddCproc("","getMultiplicity",FALSE,getMultiplicity); |
---|
1938 | p->iiAddCproc("","inequalities",FALSE,inequalities); |
---|
1939 | p->iiAddCproc("","isFullSpace",FALSE,isFullSpace); |
---|
1940 | p->iiAddCproc("","isOrigin",FALSE,isOrigin); |
---|
1941 | p->iiAddCproc("","isSimplicial",FALSE,isSimplicial); |
---|
1942 | p->iiAddCproc("","linealityDimension",FALSE,linealityDimension); |
---|
1943 | p->iiAddCproc("","linealitySpace",FALSE,linealitySpace); |
---|
1944 | p->iiAddCproc("","negatedCone",FALSE,negatedCone); |
---|
1945 | p->iiAddCproc("","quotientLatticeBasis",FALSE,quotientLatticeBasis); |
---|
1946 | p->iiAddCproc("","randomPoint",FALSE,randomPoint); |
---|
1947 | p->iiAddCproc("","rays",FALSE,rays); |
---|
1948 | p->iiAddCproc("","relativeInteriorPoint",FALSE,relativeInteriorPoint); |
---|
1949 | p->iiAddCproc("","semigroupGenerator",FALSE,semigroupGenerator); |
---|
1950 | p->iiAddCproc("","setLinearForms",FALSE,setLinearForms); |
---|
1951 | p->iiAddCproc("","setMultiplicity",FALSE,setMultiplicity); |
---|
1952 | p->iiAddCproc("","span",FALSE,impliedEquations); |
---|
1953 | p->iiAddCproc("","uniquePoint",FALSE,uniquePoint); |
---|
1954 | p->iiAddCproc("","listContainsCone",FALSE,containsCone); |
---|
1955 | p->iiAddCproc("","listOfFacets",FALSE,listOfFacets); |
---|
1956 | p->iiAddCproc("","maximalGroebnerCone",FALSE,maximalGroebnerCone); |
---|
1957 | p->iiAddCproc("","groebnerCone",FALSE,groebnerCone); |
---|
1958 | p->iiAddCproc("","initial",FALSE,initial); |
---|
1959 | p->iiAddCproc("","homogeneitySpace",FALSE,homogeneitySpace); |
---|
1960 | p->iiAddCproc("","facetContaining",FALSE,facetContaining); |
---|
1961 | coneID=setBlackboxStuff(b,"cone"); |
---|
1962 | } |
---|