2 #include <barvinok/polylib.h>
3 #include <barvinok/evalue.h>
4 #include <barvinok/options.h>
5 #include "lattice_width.h"
8 struct barvinok_options
*barvinok
;
12 struct isl_arg options_arg
[] = {
13 ISL_ARG_CHILD(struct arguments
, barvinok
, NULL
, barvinok_options_arg
, NULL
)
14 ISL_ARG_BOOL(struct arguments
, direction
, 'd', "direction", 0,
15 "print width directions")
19 ISL_ARG_DEF(options
, struct arguments
, options_arg
)
21 int main(int argc
, char **argv
)
25 const char **param_name
;
26 struct arguments
*options
= options_new_with_defaults();
27 struct width_direction_array
*dirs
;
30 argc
= options_parse(options
, argc
, argv
, ISL_ARG_ALL
);
34 P
= Constraints2Polyhedron(M
, options
->barvinok
->MaxRays
);
38 C
= Constraints2Polyhedron(M
, options
->barvinok
->MaxRays
);
40 param_name
= Read_ParamNames(stdin
, C
->Dimension
);
42 dirs
= Polyhedron_Lattice_Width_Directions(P
, C
, options
->barvinok
);
43 for (i
= 0; i
< dirs
->n
; ++i
) {
46 Print_Domain(stdout
, dirs
->wd
[i
].domain
, param_name
);
47 if (options
->direction
)
48 Vector_Print(stdout
, P_VALUE_FMT
, dirs
->wd
[i
].dir
);
49 E
= affine2evalue(dirs
->wd
[i
].width
->p
,
50 dirs
->wd
[i
].width
->p
[C
->Dimension
+1],
52 print_evalue(stdout
, E
, param_name
);
55 free_width_direction_array(dirs
);
57 Free_ParamNames(param_name
, C
->Dimension
);
60 options_free(options
);