10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-06-02 03:15:19 +02:00

Using less memory

This commit is contained in:
Anthony Scemama 2019-02-28 12:50:42 +01:00
parent a976bacfdf
commit 355aa9f166

View File

@ -53,17 +53,6 @@ let make det_space =
let ndet = Ds.size det_space in let ndet = Ds.size det_space in
let det = Ds.determinants det_space in let det = Ds.determinants det_space in
let mo_basis = Ds.mo_basis det_space in let mo_basis = Ds.mo_basis det_space in
let m_H = lazy (
Array.init ndet (fun i -> let ki = det.(i) in
Vec.init ndet (fun j -> let kj = det.(j-1) in
h_ij mo_basis ki kj
)
|> Vector.sparse_of_vec
)
|> Matrix.sparse_of_vector_array
)
in
(* (*
@ -124,13 +113,23 @@ let make det_space =
Parallel.broadcast (lazy h) Parallel.broadcast (lazy h)
) in ) in
*) *)
let m_S2 = lazy (
let m_H = lazy (
let v = Vec.make0 ndet in
Array.init ndet (fun i -> let ki = det.(i) in Array.init ndet (fun i -> let ki = det.(i) in
Vec.init ndet (fun j -> let kj = det.(j-1) in Array.iteri (fun j kj ->
CIMatrixElement.make_s2 ki kj v.{j+1} <- h_ij mo_basis ki kj) det;
) Vector.sparse_of_vec v)
|> Vector.sparse_of_vec |> Matrix.sparse_of_vector_array
) )
in
let m_S2 = lazy (
let v = Vec.make0 ndet in
Array.init ndet (fun i -> let ki = det.(i) in
Array.iteri (fun j kj ->
v.{j+1} <- CIMatrixElement.make_s2 ki kj) det;
Vector.sparse_of_vec v)
|> Matrix.sparse_of_vector_array |> Matrix.sparse_of_vector_array
) )
in in