10
1
mirror of https://gitlab.com/scemama/qmcchem.git synced 2024-12-21 20:03:31 +01:00

Accelerated qmcchem result

This commit is contained in:
Anthony Scemama 2022-01-12 00:39:43 +01:00
parent 52c16c4059
commit 46c66f5a63
4 changed files with 24 additions and 19 deletions

View File

@ -195,16 +195,6 @@ let update_raw_data ?(locked=true) () =
) result
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
begin
let result =
@ -237,6 +227,16 @@ let update_raw_data ?(locked=true) () =
end
else
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 rec aux ic accu =
let l =

View File

@ -139,9 +139,8 @@ let display_summary ~range =
and print_property property =
let p = Random_variable.of_raw_data ~range property
in
Printf.printf "%20s : %s\n"
(Property.to_string property)
(Random_variable.to_string p)
Printf.printf "%20s : %!" (Property.to_string property);
Printf.printf "%s\n%!" (Random_variable.to_string p)
in
List.iter print_property properties ;

View File

@ -209,7 +209,7 @@ let ave_error { property ; data } =
else
( Average.of_float (sum /. ansum), None)
end
| (x,w) :: tail ->
| (x, w) :: tail ->
begin
let avcu0 = avsum /. ansum in
let xw = x *. w in
@ -633,6 +633,7 @@ let to_string p =
in
Printf.sprintf "%16.10f" ave
else
begin
match ave_error p with
| (ave, Some error) ->
let idxmax =
@ -645,16 +646,18 @@ let to_string p =
Error.to_float ~idx error
in
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
f (accu ^ s) (idx+1)
(f [@tailcall]) (s :: accu) (idx+1)
else
accu
List.rev (" ]" :: accu)
in
(f "[ \n" 0) ^ " ]"
f ["[ \n"] 0
|> String.concat "\n"
| (ave, None) ->
Average.to_float ave
|> Printf.sprintf "%16.10f"
|> Printf.sprintf "%16.10f%!"
end
end

View File

@ -58,7 +58,10 @@ let of_bytes b =
| 8 -> let x = Qptypes.float_of_bytes b in
One_dimensional x
| l -> let len = l/8 in
let result =
Multidimensional ( Array.init len (fun i ->
Bytes.get_int64_le b (i*8)
|> Int64.float_of_bits ),
len )
in
result