Commit 884eeb2a authored by Erwan Jahier's avatar Erwan Jahier
Browse files

Make use of Vector.get_str10 introduce in recent version of Polka to avoid overflow problems.

parent f67b7a3c
......@@ -33,40 +33,40 @@ open Util
(Var.name -> c/coef).
*)
let rec (get_subst_from_solved_system : t' ->
((string * Value.num) * Ne.t) list -> (string * Value.num) list) =
((string * Value.num) * Ne.t) list -> (string * Value.num) list) =
fun store sl ->
match sl with
[] -> []
[] -> []
| ((vn, v), ne)::tail ->
let _ =
assert (
if
(Ne.dimension ne) >= 1
then
(
print_string (t'_to_string store);
print_string "\n*** The expression <<";
print_string (Ne.to_string ne) ;
print_string ">> ougth to be a constant.\n";
flush stdout;
false
)
else
true
)
in
let s =
match (Ne.find "" ne) with
Some(cst) -> (vn, Value.quot_num cst v)
| None -> (vn, Value.diff_num v v) (* return 0 *)
in
let new_tail =
(* We reinject the binding obtained in s into the remaining
substitutions *)
List.map
(fun (x, ne) -> (x,(Ne.apply_simple_subst ne s)))
tail
in
let _ =
assert (
if
(Ne.dimension ne) >= 1
then
(
print_string (t'_to_string store);
print_string "\n*** The expression <<";
print_string (Ne.to_string ne) ;
print_string ">> ougth to be a constant.\n";
flush stdout;
false
)
else
true
)
in
let s =
match (Ne.find "" ne) with
Some(cst) -> (vn, Value.quot_num cst v)
| None -> (vn, Value.diff_num v v) (* return 0 *)
in
let new_tail =
(* We reinject the binding obtained in s into the remaining
substitutions *)
List.map
(fun (x, ne) -> (x,(Ne.apply_simple_subst ne s)))
tail
in
s::(get_subst_from_solved_system store new_tail)
......
......@@ -439,6 +439,9 @@ let (matrix_to_vector_list : Matrix.t -> Vector.t list) =
matrix_to_vector_list2 0 []
let my_get r i =
let str = Vector.get_str10 r i in
float_of_string str
let (get_vertices : Poly.t -> (int -> string) -> point list) =
......@@ -461,11 +464,11 @@ let (get_vertices : Poly.t -> (int -> string) -> point list) =
let generators =
List.map
(fun row ->
let denom = Vector.get row 1
and line = Vector.get row 0
let denom = my_get row 1
and line = my_get row 0
in
if
(line = 0 || denom = 0)
(line = 0.0 || denom = 0.0)
then
(
Poly.print rank_to_name Format.std_formatter poly ;
......@@ -477,7 +480,7 @@ let (get_vertices : Poly.t -> (int -> string) -> point list) =
else
let rec (vector_to_point : Vector.t -> float -> int -> point) =
fun row denom cpt ->
let p = (float_of_int (Vector.get row cpt)) /. denom in
let p = ( (my_get row cpt)) /. denom in
if
(cpt = (Vector.length row) -1)
then
......@@ -485,7 +488,7 @@ let (get_vertices : Poly.t -> (int -> string) -> point list) =
else
p::(vector_to_point row denom (cpt+1))
in
vector_to_point row (float_of_int denom) 2
vector_to_point row ( denom) 2
)
row_list
in
......
......@@ -421,10 +421,6 @@ let (solve_formula: Var.env_in -> Var.env -> int -> string -> Var.name list list
(* Bdd.print_mons bdd; *)
);
[]
| Polka.Overflow ->
print_string ("Pb de débordement dans polka!\n");
flush stdout;
assert false
| e ->
print_string ((Printexc.to_string e) ^ "\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment