4 #include <barvinok/barvinok.h>
5 #include <barvinok/set.h>
6 #include <barvinok/options.h>
7 #include <barvinok/basis_reduction.h>
8 #include <barvinok/evalue.h>
9 #include <barvinok/util.h>
10 #include "conversion.h"
11 #include "evalue_read.h"
13 #include "lattice_point.h"
15 #include "bernoulli.h"
20 #include "matrix_read.h"
21 #include "remove_equalities.h"
29 void set_from_string(T
& v
, const char *s
)
31 std::istringstream
str(s
);
35 static Matrix
*matrix_read_from_str(const char *s
)
37 std::istringstream
str(s
);
38 return Matrix_Read(str
);
41 static int test_equalities(struct barvinok_options
*options
)
43 Matrix
*M
= matrix_read_from_str(
45 " 0 23 0 0 -10 0 0 0 7 -44 -8 \n"
46 " 0 0 23 0 5 0 0 0 -15 114 27 \n"
47 " 0 0 0 1 0 0 0 0 0 -1 2 \n"
48 " 0 0 0 0 0 1 0 0 -1 8 0 \n"
49 " 0 0 0 0 0 0 1 0 0 -1 2 \n"
50 " 0 0 0 0 0 0 0 1 0 -1 -1 \n"
51 " 1 0 0 0 10 0 0 0 -7 44 8 \n"
52 " 1 0 0 0 -5 0 0 0 15 -114 -27 \n"
53 " 1 0 0 0 1 0 0 0 0 0 0 \n"
54 " 1 0 0 0 0 0 0 0 1 -8 0 \n"
55 " 1 0 0 0 0 0 0 0 0 1 -2 \n");
56 Polyhedron
*P
= Constraints2Polyhedron(M
, options
->MaxRays
);
59 remove_all_equalities(&P
, NULL
, NULL
, NULL
, 2, options
->MaxRays
);
67 int test_evalue_read(struct barvinok_options
*options
)
69 unsigned nvar
, nparam
;
70 const char **all_vars
;
73 e1
= evalue_read_from_str("(1 * aa + 2 * a)",
74 NULL
, &all_vars
, &nvar
, &nparam
, options
->MaxRays
);
75 Free_ParamNames(all_vars
, nvar
+nparam
);
76 e2
= evalue_read_from_str("(3 * aa)",
77 NULL
, &all_vars
, &nvar
, &nparam
, options
->MaxRays
);
78 Free_ParamNames(all_vars
, nvar
+nparam
);
79 assert(!eequal(e1
, e2
));
85 static void evalue_check_disjoint(evalue
*e
)
91 if (EVALUE_IS_ZERO(*e
))
93 for (i
= 0; i
< e
->x
.p
->size
/2; ++i
) {
94 Polyhedron
*A
= EVALUE_DOMAIN(e
->x
.p
->arr
[2*i
]);
95 for (j
= i
+1; j
< e
->x
.p
->size
/2; ++j
) {
96 Polyhedron
*B
= EVALUE_DOMAIN(e
->x
.p
->arr
[2*j
]);
97 Polyhedron
*I
= DomainIntersection(A
, B
, 0);
104 static int test_eadd(struct barvinok_options
*options
)
106 unsigned nvar
, nparam
;
107 const char **all_vars
;
110 e1
= evalue_read_from_str(" d -1 = 0\n"
115 "d,h", &all_vars
, &nvar
, &nparam
,
117 Free_ParamNames(all_vars
, nvar
+nparam
);
118 e2
= evalue_read_from_str(
130 "d,h", &all_vars
, &nvar
, &nparam
,
132 Free_ParamNames(all_vars
, nvar
+nparam
);
134 evalue_check_disjoint(e1
);
140 int test_evalue(struct barvinok_options
*options
)
142 unsigned nvar
, nparam
;
143 const char **all_vars
;
144 evalue
*poly1
, poly2
;
146 poly1
= evalue_read_from_str("(1/4 * n^4 + 1/2 * n^3 + 1/4 * n^2)",
147 NULL
, &all_vars
, &nvar
, &nparam
,
149 Free_ParamNames(all_vars
, nvar
+nparam
);
152 evalue_copy(&poly2
, poly1
);
153 evalue_negate(poly1
);
155 reduce_evalue(poly1
);
156 assert(EVALUE_IS_ZERO(*poly1
));
158 free_evalue_refs(&poly2
);
162 int test_substitute(struct barvinok_options
*options
)
164 unsigned nvar
, nparam
;
165 const char **all_vars
;
166 const char *vars
= "a,b";
170 e1
= evalue_read_from_str("[ { 1/3 * a } = 0 ] * \n"
171 " ([ { 1/5 * b + 2/5 } = 0 ] * 5) + \n"
172 "[ { 1/3 * a } != 0 ] * 42",
173 vars
, &all_vars
, &nvar
, &nparam
,
175 Free_ParamNames(all_vars
, nvar
+nparam
);
177 subs
[0] = evalue_read_from_str("(2 * b + 5)",
178 vars
, &all_vars
, &nvar
, &nparam
,
180 Free_ParamNames(all_vars
, nvar
+nparam
);
181 subs
[1] = evalue_read_from_str("(a + 1)",
182 vars
, &all_vars
, &nvar
, &nparam
,
184 Free_ParamNames(all_vars
, nvar
+nparam
);
186 evalue_substitute(e1
, subs
);
187 evalue_free(subs
[0]);
188 evalue_free(subs
[1]);
191 e2
= evalue_read_from_str("[ { 2/3 * b + 2/3 } = 0 ] * \n"
192 " ([ { 1/5 * a + 3/5 } = 0 ] * 5) + \n"
193 "[ { 2/3 * b + 2/3 } != 0 ] * 42",
194 vars
, &all_vars
, &nvar
, &nparam
,
196 Free_ParamNames(all_vars
, nvar
+nparam
);
199 assert(eequal(e1
, e2
));
206 int test_specialization(struct barvinok_options
*options
)
215 assert(value_cmp_si(n
.coeff
->p
[0], 1) == 0);
216 assert(value_cmp_si(n
.coeff
->p
[1], 5) == 0);
217 assert(value_cmp_si(n
.coeff
->p
[2], 10) == 0);
224 assert(value_cmp_si(d
.coeff
->p
[0], 2) == 0);
225 assert(value_cmp_si(d
.coeff
->p
[1], 1) == 0);
226 assert(value_cmp_si(d
.coeff
->p
[2], 0) == 0);
229 mpq_canonicalize(count
);
230 assert(value_cmp_si(mpq_numref(count
), 31) == 0);
231 assert(value_cmp_si(mpq_denref(count
), 8) == 0);
235 assert(value_cmp_si(n2
.coeff
->p
[0], 1) == 0);
236 assert(value_cmp_si(n2
.coeff
->p
[1], -2) == 0);
237 assert(value_cmp_si(n2
.coeff
->p
[2], 3) == 0);
240 mpq_canonicalize(count
);
241 assert(value_cmp_si(mpq_numref(count
), 6) == 0);
242 assert(value_cmp_si(mpq_denref(count
), 1) == 0);
249 int test_lattice_points(struct barvinok_options
*options
)
253 set_from_string(tmp
, "[[0 0 0 0 4][0 0 0 0 4][-1 0 1 0 4]]");
254 V
.Vertex
= zz2matrix(tmp
);
256 set_from_string(lambda
, "[3 5 7]");
258 set_from_string(rays
, "[[0 1 0][4 0 1][0 0 -1]]");
262 unsigned nvar
, nparam
;
263 const char **all_vars
;
264 point
[0] = evalue_read_from_str("( -7/4 * a + ( 7/4 * c + "
265 "( 7 * {( 1/4 * a + ( 3/4 * c + 3/4 ) ) } + -21/4 ) ) )",
266 "a,b,c", &all_vars
, &nvar
, &nparam
, options
->MaxRays
);
267 Free_ParamNames(all_vars
, nvar
+nparam
);
268 point
[1] = evalue_read_from_str("( -7/4 * a + ( 7/4 * c + "
269 "( 7 * {( 1/4 * a + ( 3/4 * c + 1/2 ) ) } + -1/2 ) ) )",
270 "a,b,c", &all_vars
, &nvar
, &nparam
, options
->MaxRays
);
271 Free_ParamNames(all_vars
, nvar
+nparam
);
272 point
[2] = evalue_read_from_str("( -7/4 * a + ( 7/4 * c + "
273 "( 7 * {( 1/4 * a + ( 3/4 * c + 1/4 ) ) } + 17/4 ) ) )",
274 "a,b,c", &all_vars
, &nvar
, &nparam
, options
->MaxRays
);
275 Free_ParamNames(all_vars
, nvar
+nparam
);
276 point
[3] = evalue_read_from_str("( -7/4 * a + ( 7/4 * c + "
277 "( 7 * {( 1/4 * a + ( 3/4 * c + 0 ) ) } + 9 ) ) )",
278 "a,b,c", &all_vars
, &nvar
, &nparam
, options
->MaxRays
);
279 Free_ParamNames(all_vars
, nvar
+nparam
);
281 lattice_point(&V
, rays
, lambda
, &num
, 4, options
);
282 Matrix_Free(V
.Vertex
);
284 for (int i
= 0; i
< 4; ++i
) {
285 assert(eequal(num
.E
[i
], point
[i
]));
286 evalue_free(point
[i
]);
287 evalue_free(num
.E
[i
]);
293 static int test_icounter(struct barvinok_options
*options
)
299 set_from_string(n_coeff
, "[-2/1 1/1]");
300 set_from_string(n_power
, "[[2 6][3 6]]");
301 d_power
.SetDims(0, 2);
302 cnt
.reduce(n_coeff
, n_power
, d_power
);
303 assert(value_cmp_si(mpq_numref(cnt
.count
), -1) == 0);
304 assert(value_cmp_si(mpq_denref(cnt
.count
), 1) == 0);
308 static int test_infinite_counter(struct barvinok_options
*options
)
310 Matrix
*M
= matrix_read_from_str("1 3\n 1 1 0\n");
311 Polyhedron
*ctx
= Constraints2Polyhedron(M
, options
->MaxRays
);
314 /* (1 -1/2 x^5 - 1/2 x^7)/(1-x) */
315 infinite_counter
*cnt
= new infinite_counter(1, 1);
320 set_from_string(n_coeff
, "[1/1 -1/2 -1/2]");
321 set_from_string(n_power
, "[[0][5][7]]");
322 set_from_string(d_power
, "[[1]]");
323 cnt
->reduce(n_coeff
, n_power
, d_power
);
324 assert(value_cmp_si(mpq_numref(cnt
->count
[0]), 6) == 0);
325 assert(value_cmp_si(mpq_denref(cnt
->count
[0]), 1) == 0);
326 assert(value_cmp_si(mpq_numref(cnt
->count
[1]), 0) == 0);
327 assert(value_cmp_si(mpq_denref(cnt
->count
[1]), 1) == 0);
329 Polyhedron_Free(ctx
);
331 M
= matrix_read_from_str("2 4\n 1 1 0 0\n 1 0 1 0\n");
332 ctx
= Constraints2Polyhedron(M
, options
->MaxRays
);
335 /* (1 - xy)/((1-x)(1-xy)) */
336 cnt
= new infinite_counter(2, 3);
338 set_from_string(n_coeff
, "[1/1 -1/1]");
339 set_from_string(n_power
, "[[0 0][1 1]]");
340 set_from_string(d_power
, "[[1 0][1 1]]");
341 cnt
->reduce(n_coeff
, n_power
, d_power
);
342 assert(value_cmp_si(mpq_numref(cnt
->count
[1]), 0) != 0);
343 assert(value_cmp_si(mpq_numref(cnt
->count
[2]), 0) == 0);
344 assert(value_cmp_si(mpq_denref(cnt
->count
[2]), 1) == 0);
345 assert(value_cmp_si(mpq_numref(cnt
->count
[3]), 0) == 0);
346 assert(value_cmp_si(mpq_denref(cnt
->count
[3]), 1) == 0);
349 cnt
= new infinite_counter(2, 2);
351 set_from_string(n_coeff
, "[-1/2 1/1 -1/3]");
352 set_from_string(n_power
, "[[2 6][3 6]]");
353 d_power
.SetDims(0, 2);
354 cnt
->reduce(n_coeff
, n_power
, d_power
);
355 assert(value_cmp_si(mpq_numref(cnt
->count
[0]), 1) == 0);
356 assert(value_cmp_si(mpq_denref(cnt
->count
[0]), 6) == 0);
357 assert(value_cmp_si(mpq_numref(cnt
->count
[1]), 0) == 0);
358 assert(value_cmp_si(mpq_denref(cnt
->count
[1]), 1) == 0);
359 assert(value_cmp_si(mpq_numref(cnt
->count
[2]), 0) == 0);
360 assert(value_cmp_si(mpq_denref(cnt
->count
[2]), 1) == 0);
363 cnt
= new infinite_counter(2, 2);
365 set_from_string(n_coeff
, "[1/1]");
366 set_from_string(n_power
, "[[0 11]]");
367 set_from_string(d_power
, "[[0 1]]");
368 cnt
->reduce(n_coeff
, n_power
, d_power
);
369 assert(value_cmp_si(mpq_numref(cnt
->count
[1]), 0) != 0);
370 assert(value_cmp_si(mpq_numref(cnt
->count
[2]), 0) == 0);
371 assert(value_cmp_si(mpq_denref(cnt
->count
[2]), 1) == 0);
374 Polyhedron_Free(ctx
);
379 static int test_series(struct barvinok_options
*options
)
385 M
= matrix_read_from_str(
389 P
= Constraints2Polyhedron(M
, options
->MaxRays
);
391 C
= Universe_Polyhedron(1);
392 gf
= barvinok_series_with_options(P
, C
, options
);
395 gen_fun
*sum
= gf
->summate(1, options
);
402 int test_todd(struct barvinok_options
*options
)
404 tcounter
t(2, options
->max_index
);
405 assert(value_cmp_si(t
.todd
.coeff
->p
[0], 1) == 0);
406 assert(value_cmp_si(t
.todd
.coeff
->p
[1], -3) == 0);
407 assert(value_cmp_si(t
.todd
.coeff
->p
[2], 3) == 0);
408 assert(value_cmp_si(t
.todd_denom
->p
[0], 1) == 0);
409 assert(value_cmp_si(t
.todd_denom
->p
[1], 6) == 0);
410 assert(value_cmp_si(t
.todd_denom
->p
[2], 36) == 0);
413 set_from_string(lambda
, "[1 -1]");
414 zz2values(lambda
, t
.lambda
->p
);
417 set_from_string(rays
, "[[-1 0][-1 1]]");
422 set_from_string(v
, "[2 0 1]");
423 Vector
*vertex
= Vector_Alloc(3);
424 zz2values(v
, vertex
->p
);
426 t
.handle(rays
, vertex
->p
, one
, 1, options
);
427 assert(value_cmp_si(mpq_numref(t
.count
), 71) == 0);
428 assert(value_cmp_si(mpq_denref(t
.count
), 24) == 0);
430 set_from_string(rays
, "[[0 -1][1 -1]]");
431 set_from_string(v
, "[0 2 1]");
432 zz2values(v
, vertex
->p
);
434 t
.handle(rays
, vertex
->p
, one
, 1, options
);
435 assert(value_cmp_si(mpq_numref(t
.count
), 71) == 0);
436 assert(value_cmp_si(mpq_denref(t
.count
), 12) == 0);
438 set_from_string(rays
, "[[1 0][0 1]]");
439 set_from_string(v
, "[0 0 1]");
440 zz2values(v
, vertex
->p
);
442 t
.handle(rays
, vertex
->p
, one
, 1, options
);
443 assert(value_cmp_si(mpq_numref(t
.count
), 6) == 0);
444 assert(value_cmp_si(mpq_denref(t
.count
), 1) == 0);
450 int test_bernoulli(struct barvinok_options
*options
)
452 struct bernoulli_coef
*bernoulli_coef
;
453 struct poly_list
*faulhaber
, *bernoulli
;
454 bernoulli_coef
= bernoulli_coef_compute(2);
455 faulhaber
= faulhaber_compute(4);
456 bernoulli_coef
= bernoulli_coef_compute(8);
457 assert(value_cmp_si(bernoulli_coef
->num
->p
[6], 1) == 0);
458 assert(value_cmp_si(bernoulli_coef
->den
->p
[6], 42) == 0);
459 assert(value_cmp_si(faulhaber
->poly
[3]->p
[0], 0) == 0);
460 assert(value_cmp_si(faulhaber
->poly
[3]->p
[1], 0) == 0);
461 assert(value_cmp_si(faulhaber
->poly
[3]->p
[2], 1) == 0);
462 assert(value_cmp_si(faulhaber
->poly
[3]->p
[3], -2) == 0);
463 assert(value_cmp_si(faulhaber
->poly
[3]->p
[4], 1) == 0);
464 assert(value_cmp_si(faulhaber
->poly
[3]->p
[5], 4) == 0);
466 bernoulli
= bernoulli_compute(6);
467 assert(value_cmp_si(bernoulli
->poly
[6]->p
[0], 1) == 0);
468 assert(value_cmp_si(bernoulli
->poly
[6]->p
[1], 0) == 0);
469 assert(value_cmp_si(bernoulli
->poly
[6]->p
[2], -21) == 0);
470 assert(value_cmp_si(bernoulli
->poly
[6]->p
[3], 0) == 0);
471 assert(value_cmp_si(bernoulli
->poly
[6]->p
[4], 105) == 0);
472 assert(value_cmp_si(bernoulli
->poly
[6]->p
[5], -126) == 0);
473 assert(value_cmp_si(bernoulli
->poly
[6]->p
[6], 42) == 0);
474 assert(value_cmp_si(bernoulli
->poly
[6]->p
[7], 42) == 0);
476 unsigned nvar
, nparam
;
477 const char **all_vars
;
478 evalue
*base
, *sum1
, *sum2
;
479 base
= evalue_read_from_str("(1 * n + 1)", NULL
, &all_vars
, &nvar
, &nparam
,
482 sum1
= evalue_polynomial(faulhaber
->poly
[3], base
);
483 Free_ParamNames(all_vars
, nvar
+nparam
);
485 sum2
= evalue_read_from_str("(1/4 * n^4 + 1/2 * n^3 + 1/4 * n^2)",
486 NULL
, &all_vars
, &nvar
, &nparam
,
488 Free_ParamNames(all_vars
, nvar
+nparam
);
489 assert(eequal(sum1
, sum2
));
496 int test_bernoulli_sum(struct barvinok_options
*options
)
498 int summation
= options
->summation
;
499 options
->summation
= BV_SUM_BERNOULLI
;
501 unsigned nvar
, nparam
;
502 const char **all_vars
;
503 evalue
*e
, *sum1
, *sum2
;
504 e
= evalue_read_from_str("i + -1 >= 0\n -i + n >= 0\n\n 1 + (-1 *i) + i^2",
505 "i", &all_vars
, &nvar
, &nparam
,
507 Free_ParamNames(all_vars
, nvar
+nparam
);
509 sum1
= barvinok_summate(e
, 1, options
);
510 sum2
= evalue_read_from_str("n -1 >= 0\n\n (1/3 * n^3 + 2/3 * n)",
511 NULL
, &all_vars
, &nvar
, &nparam
,
513 Free_ParamNames(all_vars
, nvar
+nparam
);
517 assert(EVALUE_IS_ZERO(*sum1
));
521 e
= evalue_read_from_str("-i + -1 >= 0\n i + n >= 0\n\n 1 + i + i^2",
522 "i", &all_vars
, &nvar
, &nparam
,
524 Free_ParamNames(all_vars
, nvar
+nparam
);
525 sum1
= barvinok_summate(e
, 1, options
);
529 assert(EVALUE_IS_ZERO(*sum1
));
535 e
= evalue_read_from_str("i + 4 >= 0\n -i + n >= 0\n\n i",
536 "i", &all_vars
, &nvar
, &nparam
,
538 Free_ParamNames(all_vars
, nvar
+nparam
);
539 sum1
= barvinok_summate(e
, 1, options
);
540 sum2
= evalue_read_from_str("n + 0 >= 0\n\n (1/2 * n^2 + 1/2 * n + (-10))\n"
541 "n + 4 >= 0\n -n -1 >= 0\n\n (1/2 * n^2 + 1/2 * n + (-10))",
542 NULL
, &all_vars
, &nvar
, &nparam
,
544 Free_ParamNames(all_vars
, nvar
+nparam
);
548 assert(EVALUE_IS_ZERO(*sum1
));
553 e
= evalue_read_from_str("i -5 >= 0\n -i + n >= 0\n j -1 >= 0\n i -j >= 0\n"
554 "k -1 >= 0\n j -k >= 0\n\n1",
555 "i,j,k", &all_vars
, &nvar
, &nparam
,
557 Free_ParamNames(all_vars
, nvar
+nparam
);
558 sum1
= barvinok_summate(e
, 3, options
);
559 sum2
= evalue_read_from_str("n -5 >= 0\n\n"
560 "1/6 * n^3 + 1/2 * n^2 + 1/3 * n + -20",
561 NULL
, &all_vars
, &nvar
, &nparam
,
563 Free_ParamNames(all_vars
, nvar
+nparam
);
567 assert(EVALUE_IS_ZERO(*sum1
));
572 options
->summation
= summation
;
576 int test_hilbert(struct barvinok_options
*options
)
579 Matrix
*M
= matrix_read_from_str(
583 Polyhedron
*P
= Constraints2Polyhedron(M
, options
->MaxRays
);
586 M
= Cone_Hilbert_Basis(P
, options
->MaxRays
);
587 assert(M
->NbRows
== 5);
588 assert(M
->NbColumns
== 3);
591 M
= Cone_Integer_Hull(P
, NULL
, 0, options
);
592 assert(M
->NbRows
== 4);
593 assert(M
->NbColumns
== 3);
601 int test_ilp(struct barvinok_options
*options
)
603 Matrix
*M
= matrix_read_from_str(
607 Polyhedron
*P
= Constraints2Polyhedron(M
, options
->MaxRays
);
609 Vector
*obj
= Vector_Alloc(2);
610 value_set_si(obj
->p
[0], 7);
611 value_set_si(obj
->p
[1], -1);
616 value_set_si(min
, 1);
617 value_set_si(max
, 17);
618 Vector
*opt
= Polyhedron_Integer_Minimum(P
, obj
->p
, min
, max
,
621 assert(value_cmp_si(opt
->p
[0], 1) == 0);
622 assert(value_cmp_si(opt
->p
[1], 1) == 0);
623 assert(value_cmp_si(opt
->p
[2], 1) == 0);
633 int test_hull(struct barvinok_options
*options
)
635 Matrix
*M
= matrix_read_from_str(
641 Polyhedron
*P
= Constraints2Polyhedron(M
, options
->MaxRays
);
644 Matrix
*hull
= Polyhedron_Integer_Hull(P
, options
);
646 assert(hull
->NbRows
== 4);
647 M
= Matrix_Alloc(hull
->NbRows
, 1+hull
->NbColumns
);
648 for (int i
= 0; i
< hull
->NbRows
; ++i
) {
649 value_set_si(M
->p
[i
][0], 1);
650 Vector_Copy(hull
->p
[i
], M
->p
[i
]+1, hull
->NbColumns
);
653 Polyhedron
*H
= Constraints2Polyhedron(M
, options
->MaxRays
);
656 M
= matrix_read_from_str(
662 P
= Constraints2Polyhedron(M
, options
->MaxRays
);
664 assert(PolyhedronIncludes(P
, H
) && PolyhedronIncludes(H
, P
));
668 M
= matrix_read_from_str(
673 P
= Constraints2Polyhedron(M
, options
->MaxRays
);
676 hull
= Polyhedron_Integer_Hull(P
, options
);
678 assert(hull
->NbRows
== 0);
683 static int test_laurent(struct barvinok_options
*options
)
685 unsigned nvar
, nparam
;
686 const char **all_vars
;
687 evalue
*e
, *sum
, *res
;
689 e
= evalue_read_from_str(" x1 >= 0\n"
691 " -x1 -x2 + 2 >= 0\n"
694 "x1,x2", &all_vars
, &nvar
, &nparam
,
696 Free_ParamNames(all_vars
, nvar
+nparam
);
698 int summation
= options
->summation
;
699 options
->summation
= BV_SUM_LAURENT
;
700 sum
= barvinok_summate(e
, nvar
, options
);
701 options
->summation
= summation
;
703 res
= evalue_read_from_str("(6 * N + 4 * M)",
704 "", &all_vars
, &nvar
, &nparam
,
706 Free_ParamNames(all_vars
, nvar
+nparam
);
708 assert(value_zero_p(sum
->d
));
709 assert(sum
->x
.p
->type
== partition
);
710 assert(sum
->x
.p
->size
== 2);
712 assert(eequal(res
, &sum
->x
.p
->arr
[1]));
720 /* Check that Polyhedron_Reduced_Basis produces a result
721 * of the expected dimensions (without crashing).
723 static int test_basis_reduction(struct barvinok_options
*options
)
728 M
= matrix_read_from_str(
734 P
= Constraints2Polyhedron(M
, options
->MaxRays
);
737 M
= Polyhedron_Reduced_Basis(P
, options
);
740 assert(M
->NbRows
== 2);
741 assert(M
->NbColumns
== 2);
749 int main(int argc
, char **argv
)
751 struct barvinok_options
*options
= barvinok_options_new_with_defaults();
752 test_equalities(options
);
753 test_evalue_read(options
);
755 test_evalue(options
);
756 test_substitute(options
);
757 test_specialization(options
);
758 test_lattice_points(options
);
759 test_icounter(options
);
760 test_infinite_counter(options
);
761 test_series(options
);
763 test_bernoulli(options
);
764 test_bernoulli_sum(options
);
765 test_hilbert(options
);
768 test_laurent(options
);
769 test_basis_reduction(options
);
770 barvinok_options_free(options
);