Optimizations swap

This commit is contained in:
Anthony Scemama 2018-01-29 23:51:58 +01:00
parent 9262688642
commit b0a6353ade
1 changed files with 17 additions and 4 deletions

View File

@ -89,12 +89,22 @@ let to_file ~filename basis =
let
shell_q = shell_pairs.(k).(l)
in
let swap =
Array.length shell_q < Array.length shell_p
in
(* Compute all the integrals of the class *)
let cls =
if Array.length shell_q < 2 then
contracted_class_shell_pairs ~schwartz_p ~schwartz_q shell_p shell_q
if swap then
if Array.length shell_p < 2 then
contracted_class_shell_pairs ~schwartz_p:schwartz_q ~schwartz_q:schwartz_p shell_q shell_p
else
contracted_class_shell_pairs_vec ~schwartz_p:schwartz_q ~schwartz_q:schwartz_p shell_q shell_p
else
contracted_class_shell_pairs_vec ~schwartz_p ~schwartz_q shell_p shell_q
if Array.length shell_q < 2 then
contracted_class_shell_pairs ~schwartz_p ~schwartz_q shell_p shell_q
else
contracted_class_shell_pairs_vec ~schwartz_p ~schwartz_q shell_p shell_q
in
(* Write the data in the output file *)
@ -111,7 +121,10 @@ let to_file ~filename basis =
let l_c = basis.(l).Contracted_shell.indice + l_c + 1 in
let xl = to_int_tuple powers_l in
let key =
Zkey.of_int_tuple (Zkey.Twelve (xi,xj,xk,xl))
if swap then
Zkey.of_int_tuple (Zkey.Twelve (xk,xl,xi,xj))
else
Zkey.of_int_tuple (Zkey.Twelve (xi,xj,xk,xl))
in
let value =
Zmap.find cls key