1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-12-22 12:23:56 +01:00

Still working

This commit is contained in:
Francois Coppens 2023-02-10 17:16:08 +01:00
parent cc17b79316
commit 6ad4aabdfa

View File

@ -33,39 +33,39 @@ range(2, 22)
* Naïve Sherman-Morrison * Naïve Sherman-Morrison
:PROPERTIES: :PROPERTIES:
:Name: qmckl_sherman_morrison_naive :Name: qmckl_sherman_morrison_naive
:CRetType: qmckl_exit_code :CRetType: qmckl_exit_code
:FRetType: qmckl_exit_code :FRetType: qmckl_exit_code
:END: :END:
This is the simplest of the available Sherman-Morrison-Woodbury kernels. 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 when an update is evaluated. It will exit with an error code of the denominator is too close to zero.
The formula for any update $u_j$ (index $j$ is suppresed for clarity) that is applied is This is the simplest of the available Sherman-Morrison-Woodbury kernels. 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
(S + uv^T)^{-1} = S^{-1} - \frac{S^{-1} uv^T S^{-1}}{1 + v^T S^{-1} u} zero when an update is evaluated. It will exit with an error code of the denominator is too close to zero.
\]
where The formula for any update $u_j$ (index $j$ is suppresed for clarity) that is applied is
$S$ is the Slater-matrix, \[
$u$ and $v^T$ are the column and row vectors containing the updates, (S + uv^T)^{-1} = S^{-1} - \frac{S^{-1} uv^T S^{-1}}{1 + v^T S^{-1} u}
$S^{-1}$ is the inverse of the Slater-matrix. \]
Even though the Slater-matrix $S$ with all updates applied at once is invertable, during the course of applying where
updates to the inverse Slater-matrix $S^{-1}$ one-by-one it can happen that one of the intermediate inverse $S$ is the Slater-matrix,
matrices $S^{-1}$ becomes singular. Therefore a global threshold value $\epsilon$ is defined that is used to $u$ and $v^T$ are the column and row vectors containing the updates,
evaluate each individual update $u_j$ when it is applied. $S^{-1}$ is the inverse of the Slater-matrix.
This value sets the lower bound for which the Even though the Slater-matrix $S$ with all updates applied at once is invertable, during the course of applying
denominator $1+v_j^TS^{-1}u_j$ is considered to be too small and will most probably result in a singular matrix updates to the inverse Slater-matrix $S^{-1}$ one-by-one it can happen that one of the intermediate inverse
$S$, or at least in an inverse of $S$ of very poor numerical quality. Therefore, when $1+v_j^TS^{-1}u_j \geq \epsilon$, matrices $S^{-1}$ becomes singular. Therefore a global threshold value $\epsilon$ is defined that is used to
the update is applied as usual and the kernel exits with return code \texttt{QMCKL_SUCCESS}. evaluate each individual update $u_j$ when it is applied.
If $1+v_j^TS^{-1}u_j \leq \epsilon$ the update is rejected and the kernel exits with return code \texttt{QMCKL_FAILURE}.
If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting This value sets the lower bound for which the
from applying the updates to the original matrix. denominator $1+v_j^TS^{-1}u_j$ is considered to be too small and will most probably result in a singular matrix
$S$, or at least in an inverse of $S$ of very poor numerical quality. Therefore, when $1+v_j^TS^{-1}u_j \geq \epsilon$,
the update is applied as usual and the kernel exits with return code \texttt{QMCKL_SUCCESS}.
If $1+v_j^TS^{-1}u_j \leq \epsilon$ the update is rejected and the kernel exits with return code \texttt{QMCKL_FAILURE}.
If the determinant of the Slater-matrix is passed, it will be updated to the determinant resulting
from applying the updates to the original matrix.
#+NAME: qmckl_sherman_morrison_naive_args #+NAME: qmckl_sherman_morrison_naive_args
| Variable | Type | In/Out | Description | | Variable | Type | In/Out | Description |
@ -149,15 +149,15 @@ end function qmckl_sherman_morrison_naive_doc
** Requirements ** Requirements
* ~context~ is not ~QMCKL_NULL_CONTEXT~ * ~context~ is not ~QMCKL_NULL_CONTEXT~
* ~LDS >= 2~ * ~LDS >= 2~
* ~Dim >= 2~ * ~Dim >= 2~
* ~N_updates >= 1~ * ~N_updates >= 1~
* ~Updates~ is allocated with $N_updates \times Dim$ elements * ~Updates~ is allocated with $N_updates \times Dim$ elements
* ~Updates_index~ is allocated with $N_updates$ elements * ~Updates_index~ is allocated with $N_updates$ elements
* ~breakdown~ is a small number such that $0 < breakdown << 1$ * ~breakdown~ is a small number such that $0 < breakdown << 1$
* ~Slater_inv~ is allocated with $Dim \times Dim$ elements * ~Slater_inv~ is allocated with $Dim \times Dim$ elements
* ~determinant > 0~ * ~determinant > 0~
** C headers (exposed in qmckl.h) ** C headers (exposed in qmckl.h)
@ -612,9 +612,9 @@ end interface
* End of files * End of files
#+begin_src c :comments link :tangle (eval c_test) #+begin_src c :comments link :tangle (eval c_test)
assert (qmckl_context_destroy(context) == QMCKL_SUCCESS); assert (qmckl_context_destroy(context) == QMCKL_SUCCESS);
return 0; return 0;
} }
#+end_src #+end_src