mirror of
https://gitlab.com/scemama/qmcchem.git
synced 2024-12-22 04:13:31 +01:00
Accelerated qmcchem result
This commit is contained in:
parent
52c16c4059
commit
46c66f5a63
@ -195,16 +195,6 @@ let update_raw_data ?(locked=true) () =
|
|||||||
) result
|
) result
|
||||||
in
|
in
|
||||||
|
|
||||||
let rec transform new_list = function
|
|
||||||
| [] -> new_list
|
|
||||||
| head :: tail ->
|
|
||||||
let head = String.trim head in
|
|
||||||
let item = of_string head in
|
|
||||||
match item with
|
|
||||||
| None -> transform new_list tail
|
|
||||||
| Some x -> transform (x::new_list) tail
|
|
||||||
in
|
|
||||||
|
|
||||||
if Qmcchem_config.binary_io then
|
if Qmcchem_config.binary_io then
|
||||||
begin
|
begin
|
||||||
let result =
|
let result =
|
||||||
@ -237,6 +227,16 @@ let update_raw_data ?(locked=true) () =
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
let rec transform new_list = function
|
||||||
|
| [] -> new_list
|
||||||
|
| head :: tail ->
|
||||||
|
let head = String.trim head in
|
||||||
|
let item = of_string head in
|
||||||
|
match item with
|
||||||
|
| None -> transform new_list tail
|
||||||
|
| Some x -> transform (x::new_list) tail
|
||||||
|
in
|
||||||
|
|
||||||
let result =
|
let result =
|
||||||
let rec aux ic accu =
|
let rec aux ic accu =
|
||||||
let l =
|
let l =
|
||||||
|
@ -139,9 +139,8 @@ let display_summary ~range =
|
|||||||
and print_property property =
|
and print_property property =
|
||||||
let p = Random_variable.of_raw_data ~range property
|
let p = Random_variable.of_raw_data ~range property
|
||||||
in
|
in
|
||||||
Printf.printf "%20s : %s\n"
|
Printf.printf "%20s : %!" (Property.to_string property);
|
||||||
(Property.to_string property)
|
Printf.printf "%s\n%!" (Random_variable.to_string p)
|
||||||
(Random_variable.to_string p)
|
|
||||||
in
|
in
|
||||||
List.iter print_property properties ;
|
List.iter print_property properties ;
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ let ave_error { property ; data } =
|
|||||||
else
|
else
|
||||||
( Average.of_float (sum /. ansum), None)
|
( Average.of_float (sum /. ansum), None)
|
||||||
end
|
end
|
||||||
| (x,w) :: tail ->
|
| (x, w) :: tail ->
|
||||||
begin
|
begin
|
||||||
let avcu0 = avsum /. ansum in
|
let avcu0 = avsum /. ansum in
|
||||||
let xw = x *. w in
|
let xw = x *. w in
|
||||||
@ -633,6 +633,7 @@ let to_string p =
|
|||||||
in
|
in
|
||||||
Printf.sprintf "%16.10f" ave
|
Printf.sprintf "%16.10f" ave
|
||||||
else
|
else
|
||||||
|
begin
|
||||||
match ave_error p with
|
match ave_error p with
|
||||||
| (ave, Some error) ->
|
| (ave, Some error) ->
|
||||||
let idxmax =
|
let idxmax =
|
||||||
@ -645,16 +646,18 @@ let to_string p =
|
|||||||
Error.to_float ~idx error
|
Error.to_float ~idx error
|
||||||
in
|
in
|
||||||
let s =
|
let s =
|
||||||
Printf.sprintf "%8d : %16.10f +/- %16.10f ;\n" (idx+1) ave error
|
Printf.sprintf "%8d : %16.10f +/- %16.10f ;" (idx+1) ave error
|
||||||
in
|
in
|
||||||
f (accu ^ s) (idx+1)
|
(f [@tailcall]) (s :: accu) (idx+1)
|
||||||
else
|
else
|
||||||
accu
|
List.rev (" ]" :: accu)
|
||||||
in
|
in
|
||||||
(f "[ \n" 0) ^ " ]"
|
f ["[ \n"] 0
|
||||||
|
|> String.concat "\n"
|
||||||
| (ave, None) ->
|
| (ave, None) ->
|
||||||
Average.to_float ave
|
Average.to_float ave
|
||||||
|> Printf.sprintf "%16.10f"
|
|> Printf.sprintf "%16.10f%!"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +58,10 @@ let of_bytes b =
|
|||||||
| 8 -> let x = Qptypes.float_of_bytes b in
|
| 8 -> let x = Qptypes.float_of_bytes b in
|
||||||
One_dimensional x
|
One_dimensional x
|
||||||
| l -> let len = l/8 in
|
| l -> let len = l/8 in
|
||||||
|
let result =
|
||||||
Multidimensional ( Array.init len (fun i ->
|
Multidimensional ( Array.init len (fun i ->
|
||||||
Bytes.get_int64_le b (i*8)
|
Bytes.get_int64_le b (i*8)
|
||||||
|> Int64.float_of_bits ),
|
|> Int64.float_of_bits ),
|
||||||
len )
|
len )
|
||||||
|
in
|
||||||
|
result
|
||||||
|
Loading…
Reference in New Issue
Block a user