mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-22 20:36:01 +01:00
Still working
This commit is contained in:
parent
cc17b79316
commit
6ad4aabdfa
@ -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
|
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
|
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.
|
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
|
The formula for any update $u_j$ (index $j$ is suppresed for clarity) that is applied is
|
||||||
\[
|
\[
|
||||||
(S + uv^T)^{-1} = S^{-1} - \frac{S^{-1} uv^T S^{-1}}{1 + v^T S^{-1} u}
|
(S + uv^T)^{-1} = S^{-1} - \frac{S^{-1} uv^T S^{-1}}{1 + v^T S^{-1} u}
|
||||||
\]
|
\]
|
||||||
|
|
||||||
where
|
where
|
||||||
$S$ is the Slater-matrix,
|
$S$ is the Slater-matrix,
|
||||||
$u$ and $v^T$ are the column and row vectors containing the updates,
|
$u$ and $v^T$ are the column and row vectors containing the updates,
|
||||||
$S^{-1}$ is the inverse of the Slater-matrix.
|
$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
|
Even though the Slater-matrix $S$ with all updates applied at once is invertable, during the course of applying
|
||||||
updates to the inverse Slater-matrix $S^{-1}$ one-by-one it can happen that one of the intermediate inverse
|
updates to the inverse Slater-matrix $S^{-1}$ one-by-one it can happen that one of the intermediate inverse
|
||||||
matrices $S^{-1}$ becomes singular. Therefore a global threshold value $\epsilon$ is defined that is used to
|
matrices $S^{-1}$ becomes singular. Therefore a global threshold value $\epsilon$ is defined that is used to
|
||||||
evaluate each individual update $u_j$ when it is applied.
|
evaluate each individual update $u_j$ when it is applied.
|
||||||
|
|
||||||
This value sets the lower bound for which the
|
This value sets the lower bound for which the
|
||||||
denominator $1+v_j^TS^{-1}u_j$ is considered to be too small and will most probably result in a singular 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$,
|
$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}.
|
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 $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
|
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.
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user