Using less memory

This commit is contained in:
Anthony Scemama 2019-02-28 12:50:42 +01:00
parent a976bacfdf
commit 355aa9f166
1 changed files with 16 additions and 17 deletions

View File

@ -53,17 +53,6 @@ let make det_space =
let ndet = Ds.size det_space in
let det = Ds.determinants 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)
) 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
Vec.init ndet (fun j -> let kj = det.(j-1) in
CIMatrixElement.make_s2 ki kj
)
|> Vector.sparse_of_vec
)
Array.iteri (fun j kj ->
v.{j+1} <- h_ij mo_basis ki kj) det;
Vector.sparse_of_vec v)
|> 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
)
in