Commit cc105e8d authored by Benoit Barbot's avatar Benoit Barbot
Browse files

progress

parent 94535ca6
Pipeline #1674 failed with stages
in 40 seconds
......@@ -48,6 +48,7 @@ module type WeightStructure = sig
val apply_all : ?smp:float -> t -> float array -> float
val fully_apply_float : ?smp:float -> t -> var -> float -> float
val taylor_exp_s: t -> int -> t
val dominating_s : t -> (int * t) * (int * t)
end
type 'a transChoice = Label of 'a | Rand of float | Fixed
......
......@@ -26,7 +26,9 @@ module type WeightStructure =
val apply_all : ?smp:float -> t -> float array -> float
val fully_apply_float : ?smp:float -> t -> var -> float -> float
val taylor_exp_s: t -> int -> t
val dominating_s : t -> (int * t) * (int * t)
end
type 'a transChoice = Label of 'a | Rand of float | Fixed
module type S =
......
......@@ -246,6 +246,20 @@ module Make (P:Polynome.S) (Param:sig val smp:float option val tvar:P.var val sv
) ep P.zero in
Poly.singleton (Const 0) cons
let dominating_s ep =
match Poly.choose_opt ep with
| None -> (0,zero),(0,zero)
| Some ((Const ct),vt) ->
let (cl,vl),(ch,vh) = Poly.fold (fun k v (((cl,vl),(ch,vh)) as acc) -> match k with
| Const c when c < cl -> ((c,v),(ch,vh))
| Const c when c > ch -> ((cl,vl),(c,v))
| Const _ -> acc
| _ -> assert false) ep
((ct,vt),(ct,vt)) in
(cl,Poly.singleton (Const 0) vl),(ch, Poly.singleton (Const 0) vh)
| _ -> assert false
let apply_bound ep var bound =
let pb = P.of_bound bound in
......
......@@ -68,6 +68,7 @@ module type S = sig
val map_var : t -> (var -> var) -> t
val elapse_time : t -> var -> t
val taylor_exp_s: t -> int -> t
val dominating_s: t -> (int * t) * (int * t)
end
let iter_fun n f x =
......@@ -374,6 +375,7 @@ module Make (F: Fl.FSIG)(K:sig val var_string:VarSet.varset end) = struct
let taylor_exp_s p _ = p
let dominating_s p = ((0,p),(0,p))
end
......
......@@ -63,6 +63,7 @@ module type S = sig
val map_var : t -> (var -> var) -> t
val elapse_time : t -> var -> t
val taylor_exp_s: t -> int -> t
val dominating_s : t -> (int * t) * (int * t)
end
module Make :
......
......@@ -130,6 +130,13 @@ let _ =
let svar = Weight.var_of_int (Weight.nb_var-1) in
let dw = Weight.diff w svar in
let ddw = Weight.diff dw svar in
let (cl,vl),(ch,vh) = Weight.dominating_s w in
printf "Computing bound %a -> %i:%a ; %i %a @." Weight.print w cl Weight.print vl ch Weight.print vh;
let (cl,vl),(ch,vh) = Weight.dominating_s dw in
printf "Computing bound %a -> %i:%a ; %i %a @." Weight.print w cl Weight.print vl ch Weight.print vh;
let compv s =
(*Format.printf "test s: %g@." s;*)
let calc =
......@@ -150,6 +157,7 @@ let _ =
let expinf,_ = compv 1e30 in
let mexpinf,_ = compv (-100.0) in
if !verbose>0 then printf "Expected time range: [%g; %g; %g]@." (expinf+.target) (exp0+.target) (mexpinf+.target);
let x = Common.newton_raphson_iterate ~max_iter:100 compv (1.0) in
let v,_ = compv x in
if !verbose>0 then printf "%g achieved %g [%.2fs]@." x (v+.target) (check_time ());
......
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