9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-22 11:33:29 +01:00
* master: (3 commits)
  Optimized qp_edit -n (#60)
  Fix spurious EOF
  ...
This commit is contained in:
Anthony Scemama 2019-08-21 16:39:09 +02:00
commit 3f34e43418
3 changed files with 11 additions and 12 deletions

1
configure vendored
View File

@ -330,7 +330,6 @@ EOF
opam init --verbose --yes --compiler=4.07.1 --disable-sandboxing opam init --verbose --yes --compiler=4.07.1 --disable-sandboxing
eval $(opam env) eval $(opam env)
EOF
execute << EOF execute << EOF
opam install -y \${OCAML_PACKAGES} || exit 1 opam install -y \${OCAML_PACKAGES} || exit 1
EOF EOF

View File

@ -3,7 +3,8 @@ open Sexplib.Std
type t = int64 array [@@deriving sexp] type t = int64 array [@@deriving sexp]
let to_int64_array (x:t) = (x:int64 array) external to_int64_array : t -> int64 array = "%identity"
external of_int64_array_no_check : int64 array -> t = "%identity"
let to_alpha_beta x = let to_alpha_beta x =
@ -61,7 +62,6 @@ let of_int64_array ~n_int ~alpha ~beta x =
end; end;
x x
let of_int64_array_no_check x = x
let of_bitlist_couple ?n_int ~alpha ~beta (xa,xb) = let of_bitlist_couple ?n_int ~alpha ~beta (xa,xb) =
let ba, bb = let ba, bb =

View File

@ -196,8 +196,9 @@ end = struct
let write_psi_coef ~n_det ~n_states c = let write_psi_coef ~n_det ~n_states c =
let n_det = Det_number.to_int n_det let n_det = Det_number.to_int n_det
and c = Array.to_list c and c =
|> List.map Det_coef.to_float Array.map Det_coef.to_float c
|> Array.to_list
and n_states = and n_states =
States_number.to_int n_states States_number.to_int n_states
in in
@ -239,12 +240,11 @@ end = struct
assert (n_int = dim.(0)); assert (n_int = dim.(0));
assert (dim.(1) = 2); assert (dim.(1) = 2);
assert (dim.(2) = (Det_number.to_int (read_n_det ()))); assert (dim.(2) = (Det_number.to_int (read_n_det ())));
List.init dim.(2) (fun i -> Array.init dim.(2) (fun i ->
Array.sub data (2*n_int*i) (2*n_int) ) Array.sub data (2*n_int*i) (2*n_int) )
|> List.map (Determinant.of_int64_array |> Array.map (Determinant.of_int64_array
~n_int:(N_int_number.of_int n_int) ~n_int:(N_int_number.of_int n_int)
~alpha:n_alpha ~beta:n_beta ) ~alpha:n_alpha ~beta:n_beta )
|> Array.of_list
;; ;;
let write_psi_det ~n_int ~n_det d = let write_psi_det ~n_int ~n_det d =
@ -363,7 +363,7 @@ Determinants ::
" "
(b.expected_s2 |> Positive_float.to_string) (b.expected_s2 |> Positive_float.to_string)
(b.n_det |> Det_number.to_string) (b.n_det |> Det_number.to_string)
(b.state_average_weight |> Array.to_list |> List.map Positive_float.to_string |> String.concat "\t") (b.state_average_weight |> Array.map Positive_float.to_string |> Array.to_list |> String.concat "\t")
det_text det_text
|> Rst_string.of_string |> Rst_string.of_string
;; ;;
@ -387,10 +387,10 @@ psi_det = %s
(b.n_states |> States_number.to_string) (b.n_states |> States_number.to_string)
(b.expected_s2 |> Positive_float.to_string) (b.expected_s2 |> Positive_float.to_string)
(b.state_average_weight |> Array.to_list |> List.map Positive_float.to_string |> String.concat ",") (b.state_average_weight |> Array.to_list |> List.map Positive_float.to_string |> String.concat ",")
(b.psi_coef |> Array.to_list |> List.map Det_coef.to_string (b.psi_coef |> Array.map Det_coef.to_string |> Array.to_list
|> String.concat ", ") |> String.concat ", ")
(b.psi_det |> Array.to_list |> List.map (Determinant.to_string (b.psi_det |> Array.map (Determinant.to_string ~mo_num) |> Array.to_list
~mo_num) |> String.concat "\n\n") |> String.concat "\n\n")
;; ;;
let of_rst r = let of_rst r =