10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-07-25 12:17:25 +02:00

Optimized 0m

This commit is contained in:
Anthony Scemama 2018-02-09 02:01:26 +01:00
parent 6e2c5130ca
commit e148515f91

View File

@ -19,11 +19,19 @@ type t = (float, float64_elt, fortran_layout) Bigarray.Genarray.t
let zero_m ~maxm ~expo_pq_inv ~norm_pq_sq =
let exp_pq = 1. /. expo_pq_inv in
let t = norm_pq_sq *. exp_pq in
boys_function ~maxm t
|> Array.mapi (fun m fm ->
two_over_sq_pi *. (if m mod 2 = 0 then fm else -.fm) *.
(pow exp_pq m) *. (sqrt exp_pq)
)
let f = two_over_sq_pi *. (sqrt exp_pq) in
let result = boys_function ~maxm t in
let rec aux accu k = function
| 0 -> result.(k) <- result.(k) *. accu
| l ->
begin
result.(k) <- result.(k) *. accu;
let new_accu = -. accu *. exp_pq in
aux new_accu (k+1) (l-1)
end
in
aux f 0 maxm;
result
(** Compute all the integrals of a contracted class *)