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 ISL_ARGS_START(struct arguments
, options_args
)
13 ISL_ARG_CHILD(struct arguments
, barvinok
, NULL
, &barvinok_options_args
, NULL
)
14 ISL_ARG_BOOL(struct arguments
, direction
, 'd', "direction", 0,
15 "print width directions")
18 ISL_ARG_DEF(options
, struct arguments
, options_args
)
20 int main(int argc
, char **argv
)
24 const char **param_name
;
25 struct arguments
*options
= options_new_with_defaults();
26 struct width_direction_array
*dirs
;
29 argc
= options_parse(options
, argc
, argv
, ISL_ARG_ALL
);
33 P
= Constraints2Polyhedron(M
, options
->barvinok
->MaxRays
);
37 C
= Constraints2Polyhedron(M
, options
->barvinok
->MaxRays
);
39 param_name
= Read_ParamNames(stdin
, C
->Dimension
);
41 dirs
= Polyhedron_Lattice_Width_Directions(P
, C
, options
->barvinok
);
42 for (i
= 0; i
< dirs
->n
; ++i
) {
45 Print_Domain(stdout
, dirs
->wd
[i
].domain
, param_name
);
46 if (options
->direction
)
47 Vector_Print(stdout
, P_VALUE_FMT
, dirs
->wd
[i
].dir
);
48 E
= affine2evalue(dirs
->wd
[i
].width
->p
,
49 dirs
->wd
[i
].width
->p
[C
->Dimension
+1],
51 print_evalue(stdout
, E
, param_name
);
54 free_width_direction_array(dirs
);
56 Free_ParamNames(param_name
, C
->Dimension
);
59 options_free(options
);