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