mirror of
https://gitlab.com/scemama/QCaml.git
synced 2025-01-03 10:05:40 +01:00
Accelerated 4idx
This commit is contained in:
parent
37ccd24d3e
commit
76627c5e95
@ -110,6 +110,7 @@ let unsafe_set_four_index ~r1 ~r2 ~value t =
|
||||
begin
|
||||
unsafe_set t.two_index i j value;
|
||||
unsafe_set t.two_index j i value;
|
||||
unsafe_set t.three_index (dense_index i i t.size) j value;
|
||||
end;
|
||||
unsafe_set t.three_index (dense_index j l t.size) i value;
|
||||
unsafe_set t.three_index (dense_index l j t.size) i value;
|
||||
@ -126,6 +127,7 @@ let unsafe_set_four_index ~r1 ~r2 ~value t =
|
||||
begin
|
||||
unsafe_set t.two_index_anti i j value;
|
||||
unsafe_set t.two_index_anti j i value;
|
||||
unsafe_set t.three_index_anti (dense_index i i t.size) j value;
|
||||
end;
|
||||
unsafe_set t.three_index_anti (dense_index j k t.size) i value;
|
||||
unsafe_set t.three_index_anti (dense_index k j t.size) i value;
|
||||
@ -142,6 +144,7 @@ let unsafe_set_four_index ~r1 ~r2 ~value t =
|
||||
begin
|
||||
unsafe_set t.two_index_anti i k value;
|
||||
unsafe_set t.two_index_anti k i value;
|
||||
unsafe_set t.three_index_anti (dense_index i i t.size) k value;
|
||||
end;
|
||||
unsafe_set t.three_index_anti (dense_index k l t.size) i value;
|
||||
unsafe_set t.three_index_anti (dense_index l k t.size) i value;
|
||||
@ -277,25 +280,27 @@ let get_phys_all_ij d ~k ~l =
|
||||
|
||||
|
||||
let get_chem_all_ij d ~k ~l =
|
||||
(*
|
||||
|
||||
if k = l then
|
||||
|
||||
let result =
|
||||
Mat.col d.three_index k
|
||||
|> Bigarray.genarray_of_array1
|
||||
in
|
||||
Bigarray.reshape_2 result d.size d.size
|
||||
|
||||
else
|
||||
*)
|
||||
match d.four_index with
|
||||
| Dense a ->
|
||||
let kl = sym_index k l in
|
||||
let result =
|
||||
Mat.col a kl
|
||||
|> Bigarray.genarray_of_array1
|
||||
in
|
||||
Bigarray.reshape_2 result d.size d.size
|
||||
| Sparse a ->
|
||||
Mat.init_cols d.size d.size (fun i j -> get_chem d i j k l)
|
||||
|
||||
match d.four_index with
|
||||
| Dense a ->
|
||||
let kl = sym_index k l in
|
||||
let result =
|
||||
Mat.col a kl
|
||||
|> Bigarray.genarray_of_array1
|
||||
in
|
||||
Bigarray.reshape_2 result d.size d.size
|
||||
| Sparse a ->
|
||||
Mat.init_cols d.size d.size (fun i j -> get_chem d i j k l)
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user