From 37a408c9dd065a6dd3c189b42b4355b69e026481 Mon Sep 17 00:00:00 2001 From: Francois Coppens Date: Tue, 14 Sep 2021 09:55:55 +0200 Subject: [PATCH] Add fortran interface --- org/qmckl_sherman_morrison_woodbury.org | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/org/qmckl_sherman_morrison_woodbury.org b/org/qmckl_sherman_morrison_woodbury.org index b982d50..11369e1 100644 --- a/org/qmckl_sherman_morrison_woodbury.org +++ b/org/qmckl_sherman_morrison_woodbury.org @@ -1,6 +1,7 @@ #+TITLE: Sherman-Morrison-Woodbury #+SETUPFILE: ../tools/theme.setup #+INCLUDE: ../tools/lib.org +#+STARTUP: content Low- and high-level functions that use the Sherman-Morrison and Woodbury matrix inversion formulas to update the inverse of a @@ -95,7 +96,26 @@ int main() { double* Slater_inv ); #+end_src -*** Source +*** Fortran source + + #+begin_src c :tangle (eval c) :comments org +integer function qmckl_sherman_morrison_f(context, Dim, N_updates, Updates, & + Updates_index, breakdown, Slater_inv) result(info) + use qmckl + implicit none + integer(qmckl_context) , intent(in) :: context + integer*8 , intent(in) :: Dim, N_updates + integer*8 , intent(in) :: Updates_index(N_updates) + real*8 , intent(in) :: breakdown + real*8 , intent(in) :: Updates(N_updates*Dim) + real*8 , intent(inout) :: Slater_inv(Dim*Dim) + info = qmckl_sherman_morrison(context, Dim, N_updates, Updates, & + Updates_index, breakdown, Slater_inv) + ) +end function qmckl_sherman_morrison_f + #+end_src + +*** C source #+begin_src c :tangle (eval c) :comments org #include @@ -168,6 +188,8 @@ qmckl_exit_code qmckl_sherman_morrison_c(const qmckl_context context, :END: #+CALL: generate_c_interface(table=qmckl_sherman_morrison_args,rettyp=get_value("FRetType"),fname=get_value("Name")) + + #+RESULTS: #+CALL: generate_f_interface(table=qmckl_sherman_morrison_args,rettyp=get_value("FRetType"),fname=get_value("Name"))