minor changes

This commit is contained in:
Anthony Scemama 2019-06-19 14:04:57 +02:00
parent 91a2ec1288
commit 58f51dbecf
2 changed files with 14 additions and 13 deletions

16
.merlin
View File

@ -1,12 +1,8 @@
PKG str unix bigarray lacaml zarith mpi alcotest
EXCLUDE_QUERY_DIR
B _build/default/.run_hartree_fock.eobjs/byte
B _build/default/Basis/.Basis.objs/byte
B _build/default/Nuclei/.Nuclei.objs/byte
S .
S Test
S Nuclei
S Parallel
S CI
S Utils
S Basis
S SCF
S MOBasis
S CI
B _build/**
S Nuclei
FLG -w @a-4-29-40-41-42-44-45-48-58-59-60-40 -strict-sequence -strict-formats -short-paths -keep-locs

View File

@ -3,13 +3,16 @@ open Lacaml.D
let full_ldl m_A =
let n = Mat.dim1 m_A in
assert (Mat.dim2 m_A = n);
let v_D = Vec.make0 n in
let m_Lt = Mat.identity n in
let v_D_inv = Vec.make0 n in
let compute_d j =
let l_jk =
Mat.col m_Lt j
@ -20,6 +23,7 @@ let full_ldl m_A =
m_A.{j,j} -. dot ~n:(j-1) l_jk l_jk__d_k
in
let compute_l i =
let l_ik__d_k =
Mat.col m_Lt i
@ -33,6 +37,7 @@ let full_ldl m_A =
v_D_inv.{j} *. ( m_A.{j,i} -. dot ~n:(j-1) l_ik__d_k l_jk )
in
for i=1 to n do
for j=1 to (i-1) do
m_Lt.{j,i} <- compute_l i j;
@ -85,12 +90,12 @@ let pivoted_ldl threshold m_A =
let rec aux (pos,value) i =
if i > n then
pos
else if m_D.{i} > value then
aux i m_D.{i} (i+1)
else if v_D.{i} > value then
aux i v_D.{i} (i+1)
else
aux pos value (i+1)
in
let j = aux i m_D.{i} (i+1) in
let j = aux i v_D.{i} (i+1) in
let p_i, p_j = pi.(i), pi.(j) in
pi.(i) <- pj;
pi.(j) <- pi;