From 34033829e471a5ffa9e02a19f6ec492a1e0ad40a Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 3 Apr 2019 23:09:20 +0200 Subject: [PATCH] Working on CI --- CI/CI.ml | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/CI/CI.ml b/CI/CI.ml index e9232ef..e3791cd 100644 --- a/CI/CI.ml +++ b/CI/CI.ml @@ -337,6 +337,15 @@ let create_matrix_spin f det_space = ) +type mdata = + { i_a : int ref; + j_a : int ref; + j0 : int ref; + j_alfa_prev : int ref; + bi : int; + h1 : (int -> int -> int -> int -> float) ref + h123_prev : (int -> float) ref + } (* Create a matrix using the fact that the determinant space is made of the outer product of spindeterminants. *) @@ -389,24 +398,26 @@ let create_matrix_spin_computed f det_space = if i <> !i_prev then begin i_prev := i; + let j_a = ref (-n_alfa) in + let j0 = ref (!j_a * n_beta) in let i_a = (i-1)/n_beta in let i_alfa = i_a + 1 in let h1 = h (i_alfa-1) in - let i_beta = i - i_a*n_beta in - let bi = (i_beta-1) in - let h123_prev = ref (fun _ -> 0.) in - let j_a = ref (-n_alfa) in + let bi = + let i_beta = i - i_a*n_beta in + i_beta-1 + in let j_alfa_prev = ref (-10) in - let j0 = ref (!j_a * n_beta) in - result := fun j -> - if j > !j0 + n_beta - || j < !j0 - then begin - j_a := (j-1)/n_beta; - j0 := !j_a * n_beta - end; + let h123_prev = ref (fun _ -> 0.) in + let f j = + if j > !j0 + n_beta || j < !j0 then + begin + let x = (j-1)/n_beta in + j_a := x; + j0 := x * n_beta + end; let j_alfa = !j_a + 1 in let h123 = if j_alfa <> !j_alfa_prev then @@ -418,6 +429,8 @@ let create_matrix_spin_computed f det_space = in let j_beta = j - !j0 in h123 (j_beta-1) + in + result := f ; end; !result in