From 081e27dd92575c4254a2843f6e57349fce2c603e Mon Sep 17 00:00:00 2001 From: vijay gopal chilkuri Date: Wed, 21 Jul 2021 17:42:48 +0200 Subject: [PATCH] Bug fix in tests. #25 --- org/qmckl_sherman_morrison_woodbury.org | 34 ++++++++++++++++--------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index f6efc80..565789b 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -326,12 +326,16 @@ const uint64_t Updates_index[2] = {0, 0}; const double Updates[4] = {0.0, 0.0, 0.0, 0.0}; double Slater_inv[4] = {0.0, 0.0, 0.0, 0.0}; +// [TODO : FMJC ] add realistic tests + rc = qmckl_sherman_morrison_c(context, Dim, N_updates, Updates, Updates_index, Slater_inv); assert(rc == QMCKL_SUCCESS); #+end_src * Woodbury 2x2 + +[TODO: FMJC] Add main body intro. ** ~qmckl_woodbury_2~ :PROPERTIES: @@ -340,14 +344,18 @@ assert(rc == QMCKL_SUCCESS); :FRetType: qmckl_exit_code :END: - This is the simplest of the available Sherman-Morrison-Woodbury kernels in QMCkl. It applies rank-1 updates one by one in the order that is given. It only checks if the denominator in the Sherman-Morrison formula is not too close to zero (and exit with an error if it does) during the application of an update. + This is the simplest of the available Sherman-Morrison-Woodbury + kernels in QMCkl. It applies rank-1 updates one by one in the order + that is given. It only checks if the denominator in the + Sherman-Morrison formula is not too close to zero (and exit with an + error if it does) during the application of an update. #+NAME: qmckl_woodbury_2_args - | qmckl_context | context | in | Global state | - | uint64_t | Dim | in | Leading dimension of Slater_inv | - | double | Updates[2*Dim] | in | Array containing the updates | - | uint64_t | Updates_index[2] | in | Array containing the rank-1 updates | - | double | Slater_inv[Dim*Dim] | inout | Array containing the inverse of a Slater-matrix | + | qmckl_context | context | in | Global state | + | uint64_t | Dim | in | Leading dimension of Slater_inv | + | double | Updates[2*Dim] | in | Array containing the updates | + | uint64_t | Updates_index[2] | in | Array containing the rank-1 updates | + | double | Slater_inv[Dim*Dim] | inout | Array containing the inverse of a Slater-matrix | *** Requirements @@ -463,7 +471,7 @@ qmckl_exit_code qmckl_woodbury_2_c(const qmckl_context context, #+end_src - + *** Performance ** C interface :noexport: @@ -520,12 +528,14 @@ qmckl_exit_code qmckl_woodbury_2_c(const qmckl_context context, #+begin_src c :tangle (eval c_test) -const uint64_t Dim2 = 2; -const uint64_t Updates_index2[2] = {0, 0}; -const double Updates2[4] = {0.0, 0.0, 0.0, 0.0}; -double Slater_inv2[4] = {0.0, 0.0, 0.0, 0.0}; +const uint64_t woodbury_Dim = 2; +const uint64_t woodbury_Updates_index[2] = {1, 1}; +const double woodbury_Updates[4] = {1.0, 1.0, 1.0, 1.0}; +double woodbury_Slater_inv[4] = {1.0, 1.0, 1.0, 1.0}; -rc = qmckl_woodbury_2_c(context, Dim, Updates, Updates_index, Slater_inv); +// [TODO : FMJC ] add realistic tests + +rc = qmckl_woodbury_2_c(context, woodbury_Dim, woodbury_Updates, woodbury_Updates_index, woodbury_Slater_inv); assert(rc == QMCKL_SUCCESS); #+end_src