Commit 718af3d3 authored by Benoit Barbot's avatar Benoit Barbot
Browse files

progress bug to fix

parent 7547777a
Pipeline #1672 failed with stages
in 17 seconds
......@@ -47,6 +47,7 @@ module type WeightStructure = sig
val to_float : ?smp:float -> t -> float option
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
end
type 'a transChoice = Label of 'a | Rand of float | Fixed
......
......@@ -25,6 +25,7 @@ module type WeightStructure =
val to_float : ?smp:float -> t -> float option
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
end
type 'a transChoice = Label of 'a | Rand of float | Fixed
......
......@@ -67,6 +67,7 @@ module type S = sig
val of_bound : bound -> t
val map_var : t -> (var -> var) -> t
val elapse_time : t -> var -> t
val taylor_exp_s: t -> int -> t
end
let iter_fun n f x =
......@@ -370,6 +371,10 @@ module Make (F: Fl.FSIG)(K:sig val var_string:VarSet.varset end) = struct
cip := ci
done;
!ptilde
let taylor_exp_s p _ = p
end
(*
......
......@@ -62,6 +62,7 @@ module type S = sig
val of_bound : Common.bound -> t
val map_var : t -> (var -> var) -> t
val elapse_time : t -> var -> t
val taylor_exp_s: t -> int -> t
end
module Make :
......
......@@ -125,6 +125,18 @@ let _ =
let dw = Weight.diff w svar in
let ddw = Weight.diff dw svar in
let compv s =
if s=0.0 then
let svar = P.var_of_int (P.nb_var-1) in
let we = Weight.taylor_exp_s w (!npoly) in
(*Format.printf "vte: %a@." P.print we;*)
let de = Weight.taylor_exp_s dw (!npoly+1) in
Format.printf "vte: %a@." P.print de;
let w0 = P.apply we svar (P.const P.F.zero) in
let d0 = P.apply de svar (P.const P.F.zero) in
match P.to_float w0,P.to_float d0 with
Some v1,Some v2 -> v1,v2
| _ -> failwith "fail to evaluate"
else
match Weight.to_float ~smp:s w ,Weight.to_float ~smp:s dw, Weight.to_float ~smp:s ddw with
Some v,Some dv,Some ddv -> -. dv /. v -.target , -.ddv /. v +. dv*.dv /. (v*.v)
| _ -> failwith "fail to evaluate" in
......
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