[PPL-devel] ocaml interface issues

Enea Zaffanella zaffanella at cs.unipr.it
Sat Feb 5 17:30:17 CET 2011


Il 05/02/2011 00:50, piotrm ha scritto:
> Hellos, "Out_of_memory" exceptions are thrown using the ocaml interface
> when doing very very simple tasks, like below.

Hello.

Just to confirm that something wrong is going on.
I have no time to check the details right now,
but the first impression is that our OCaml interface function

    ppl_Pointset_Powerset_*_get_disjunct

is buggy and returns a totally invalid value
(so that accessing it later yields arbitrary behavior).

Thanks for reporting!

> I have yet to find an
> example on the use of linear_partition using the ocaml interface so I
> hope I'm not embarrassing myself by using it incorrectly. Also, the
> ppl_Polyhedron_OK returns false right before get_minimized_constraints
> (or most other polyhedron functions) result in the exception.
> 
> The same task is performed just fine using the C++ interface. Any info
> regarding this issue would be greatly appreciated.
> 
> open Printf
> open Gmp
> open Ppl_ocaml
> 
> let v1 = Variable 0;;
> 
> let p1 = ppl_new_C_Polyhedron_from_space_dimension 1 Universe;;
> ppl_Polyhedron_add_constraint p1 (Less_Or_Equal (v1, (Coefficient
> (Z.of_int 2))));;
> ppl_Polyhedron_add_constraint p1 (Greater_Or_Equal (v1, (Coefficient
> (Z.of_int 1))));;
> 
> let p2 = ppl_new_C_Polyhedron_from_space_dimension 1 Universe;;
> ppl_Polyhedron_add_constraint p2 (Less_Or_Equal (v1, (Coefficient
> (Z.of_int 3))));;

This is unrelated to the reported bug,
but probably here below you meant p2 and not p1.

Cheers,
Enea Zaffanella.

> ppl_Polyhedron_add_constraint p1 (Greater_Or_Equal (v1, (Coefficient
> (Z.of_int 2))));;
> 
> let (pinter, parts_of_p2) = ppl_Polyhedron_linear_partition p1 p2 in
> 
> let it = ppl_Pointset_Powerset_NNC_Polyhedron_begin_iterator parts_of_p2 in
> let itend = ppl_Pointset_Powerset_NNC_Polyhedron_end_iterator
> parts_of_p2 in
> 
>   while (not
> (ppl_Pointset_Powerset_NNC_Polyhedron_iterator_equals_iterator it
> itend)) do
> 
>     let p = ppl_Pointset_Powerset_NNC_Polyhedron_get_disjunct it in
>       printf "ok = %s\n" (string_of_bool (ppl_Polyhedron_OK p));
>       flush stdout;
> 
>       ignore (ppl_Polyhedron_get_minimized_constraints p); (*
> Out_of_memory exception here *);
> 
>       ppl_Pointset_Powerset_NNC_Polyhedron_increment_iterator it
>   done
> ;;
> _______________________________________________
> PPL-devel mailing list
> PPL-devel at cs.unipr.it
> http://www.cs.unipr.it/mailman/listinfo/ppl-devel
> 




More information about the PPL-devel mailing list