mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2025-01-03 01:56:18 +01:00
Cleaning Fortran
This commit is contained in:
parent
50fa3aa754
commit
0d9af3c497
690
org/qmckl_ao.org
690
org/qmckl_ao.org
File diff suppressed because it is too large
Load Diff
@ -86,7 +86,7 @@ int main() {
|
|||||||
const double* B,
|
const double* B,
|
||||||
const int64_t ldb,
|
const int64_t ldb,
|
||||||
double* const C,
|
double* const C,
|
||||||
const int64_t ldc );
|
const int64_t ldc );
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src f90 :tangle (eval f)
|
#+begin_src f90 :tangle (eval f)
|
||||||
@ -231,21 +231,21 @@ end function qmckl_distance_sq
|
|||||||
This function is more efficient when ~A~ and ~B~ are
|
This function is more efficient when ~A~ and ~B~ are
|
||||||
transposed.
|
transposed.
|
||||||
|
|
||||||
#+CALL: generate_f_interface(table=qmckl_distance_sq_args,rettyp=get_value("FRetType"),fname=get_value("Name"))
|
#+CALL: generate_f_interface(table=qmckl_distance_sq_args,fname=get_value("Name"))
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||||
interface
|
interface
|
||||||
integer(c_int32_t) function qmckl_distance_sq &
|
integer(qmckl_exit_code) function qmckl_distance_sq &
|
||||||
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc) &
|
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc) &
|
||||||
bind(C)
|
bind(C)
|
||||||
use, intrinsic :: iso_c_binding
|
use, intrinsic :: iso_c_binding
|
||||||
import
|
import
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer (c_int64_t) , intent(in) , value :: context
|
integer (qmckl_context), intent(in) , value :: context
|
||||||
character(c_char) , intent(in) , value :: transa
|
character(c_char ) , intent(in) , value :: transa
|
||||||
character(c_char) , intent(in) , value :: transb
|
character(c_char ) , intent(in) , value :: transb
|
||||||
integer (c_int64_t) , intent(in) , value :: m
|
integer (c_int64_t) , intent(in) , value :: m
|
||||||
integer (c_int64_t) , intent(in) , value :: n
|
integer (c_int64_t) , intent(in) , value :: n
|
||||||
real (c_double ) , intent(in) :: A(lda,*)
|
real (c_double ) , intent(in) :: A(lda,*)
|
||||||
@ -462,25 +462,29 @@ end function test_qmckl_distance_sq
|
|||||||
const double* B,
|
const double* B,
|
||||||
const int64_t ldb,
|
const int64_t ldb,
|
||||||
double* const C,
|
double* const C,
|
||||||
const int64_t ldc );
|
const int64_t ldc );
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** Source
|
*** Source
|
||||||
#+begin_src f90 :tangle (eval f)
|
#+begin_src f90 :tangle (eval f)
|
||||||
integer function qmckl_distance_f(context, transa, transb, m, n, &
|
function qmckl_distance(context, transa, transb, m, n, &
|
||||||
A, LDA, B, LDB, C, LDC) &
|
A, LDA, B, LDB, C, LDC) &
|
||||||
result(info)
|
bind(C) result(info)
|
||||||
use qmckl
|
use, intrinsic :: iso_c_binding
|
||||||
|
use qmckl_constants
|
||||||
implicit none
|
implicit none
|
||||||
integer(qmckl_context) , intent(in) :: context
|
integer(qmckl_context), intent(in), value :: context
|
||||||
character , intent(in) :: transa, transb
|
character(c_char) , intent(in) , value :: transa
|
||||||
integer*8 , intent(in) :: m, n
|
character(c_char) , intent(in) , value :: transb
|
||||||
integer*8 , intent(in) :: lda
|
integer (c_int64_t) , intent(in) , value :: m
|
||||||
real*8 , intent(in) :: A(lda,*)
|
integer (c_int64_t) , intent(in) , value :: n
|
||||||
integer*8 , intent(in) :: ldb
|
real (c_double ) , intent(in) :: A(lda,*)
|
||||||
real*8 , intent(in) :: B(ldb,*)
|
integer (c_int64_t) , intent(in) , value :: lda
|
||||||
integer*8 , intent(in) :: ldc
|
real (c_double ) , intent(in) :: B(ldb,*)
|
||||||
real*8 , intent(out) :: C(ldc,*)
|
integer (c_int64_t) , intent(in) , value :: ldb
|
||||||
|
real (c_double ) , intent(out) :: C(ldc,n)
|
||||||
|
integer (c_int64_t) , intent(in) , value :: ldc
|
||||||
|
integer (qmckl_exit_code) :: info
|
||||||
|
|
||||||
integer*8 :: i,j
|
integer*8 :: i,j
|
||||||
real*8 :: x, y, z
|
real*8 :: x, y, z
|
||||||
@ -605,60 +609,24 @@ integer function qmckl_distance_f(context, transa, transb, m, n, &
|
|||||||
|
|
||||||
end select
|
end select
|
||||||
|
|
||||||
end function qmckl_distance_f
|
end function qmckl_distance
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** Performance
|
#+CALL: generate_f_interface(table=qmckl_distance_args,fname="qmckl_distance")
|
||||||
|
|
||||||
This function is more efficient when ~A~ and ~B~ are transposed.
|
|
||||||
|
|
||||||
** C interface :noexport:
|
|
||||||
|
|
||||||
#+CALL: generate_c_interface(table=qmckl_distance_args,rettyp=get_value("FRetType"),fname=get_value("Name"))
|
|
||||||
|
|
||||||
#+RESULTS:
|
|
||||||
#+begin_src f90 :tangle (eval f) :comments org :exports none
|
|
||||||
integer(c_int32_t) function qmckl_distance &
|
|
||||||
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc) &
|
|
||||||
bind(C) result(info)
|
|
||||||
|
|
||||||
use, intrinsic :: iso_c_binding
|
|
||||||
implicit none
|
|
||||||
|
|
||||||
integer (c_int64_t) , intent(in) , value :: context
|
|
||||||
character(c_char) , intent(in) , value :: transa
|
|
||||||
character(c_char) , intent(in) , value :: transb
|
|
||||||
integer (c_int64_t) , intent(in) , value :: m
|
|
||||||
integer (c_int64_t) , intent(in) , value :: n
|
|
||||||
real (c_double ) , intent(in) :: A(lda,*)
|
|
||||||
integer (c_int64_t) , intent(in) , value :: lda
|
|
||||||
real (c_double ) , intent(in) :: B(ldb,*)
|
|
||||||
integer (c_int64_t) , intent(in) , value :: ldb
|
|
||||||
real (c_double ) , intent(out) :: C(ldc,n)
|
|
||||||
integer (c_int64_t) , intent(in) , value :: ldc
|
|
||||||
|
|
||||||
integer(c_int32_t), external :: qmckl_distance_f
|
|
||||||
info = qmckl_distance_f &
|
|
||||||
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc)
|
|
||||||
|
|
||||||
end function qmckl_distance
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+CALL: generate_f_interface(table=qmckl_distance_args,rettyp=get_value("FRetType"),fname=get_value("Name"))
|
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||||
interface
|
interface
|
||||||
integer(c_int32_t) function qmckl_distance &
|
integer(qmckl_exit_code) function qmckl_distance &
|
||||||
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc) &
|
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc) &
|
||||||
bind(C)
|
bind(C)
|
||||||
use, intrinsic :: iso_c_binding
|
use, intrinsic :: iso_c_binding
|
||||||
import
|
import
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer (c_int64_t) , intent(in) , value :: context
|
integer (qmckl_context), intent(in) , value :: context
|
||||||
character(c_char) , intent(in) , value :: transa
|
character(c_char ) , intent(in) , value :: transa
|
||||||
character(c_char) , intent(in) , value :: transb
|
character(c_char ) , intent(in) , value :: transb
|
||||||
integer (c_int64_t) , intent(in) , value :: m
|
integer (c_int64_t) , intent(in) , value :: m
|
||||||
integer (c_int64_t) , intent(in) , value :: n
|
integer (c_int64_t) , intent(in) , value :: n
|
||||||
real (c_double ) , intent(in) :: A(lda,*)
|
real (c_double ) , intent(in) :: A(lda,*)
|
||||||
@ -672,6 +640,10 @@ end function qmckl_distance_f
|
|||||||
end interface
|
end interface
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
*** Performance
|
||||||
|
|
||||||
|
This function is more efficient when ~A~ and ~B~ are transposed.
|
||||||
|
|
||||||
*** Test :noexport:
|
*** Test :noexport:
|
||||||
#+begin_src f90 :tangle (eval f_test)
|
#+begin_src f90 :tangle (eval f_test)
|
||||||
|
|
||||||
@ -886,26 +858,30 @@ end function test_qmckl_dist
|
|||||||
const int64_t ldb,
|
const int64_t ldb,
|
||||||
double* const C,
|
double* const C,
|
||||||
const int64_t ldc,
|
const int64_t ldc,
|
||||||
const double rescale_factor_kappa );
|
const double rescale_factor_kappa );
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** Source
|
*** Source
|
||||||
#+begin_src f90 :tangle (eval f)
|
#+begin_src f90 :tangle (eval f)
|
||||||
integer function qmckl_distance_rescaled_f(context, transa, transb, m, n, &
|
function qmckl_distance_rescaled(context, transa, transb, m, n, &
|
||||||
A, LDA, B, LDB, C, LDC, rescale_factor_kappa) &
|
A, LDA, B, LDB, C, LDC, rescale_factor_kappa) &
|
||||||
result(info)
|
bind(C) result(info)
|
||||||
use qmckl
|
use, intrinsic :: iso_c_binding
|
||||||
|
use qmckl_constants
|
||||||
implicit none
|
implicit none
|
||||||
integer(qmckl_context) , intent(in) :: context
|
integer (qmckl_context), intent(in) , value :: context
|
||||||
character , intent(in) :: transa, transb
|
character(c_char ) , intent(in) , value :: transa
|
||||||
integer*8 , intent(in) :: m, n
|
character(c_char ) , intent(in) , value :: transb
|
||||||
integer*8 , intent(in) :: lda
|
integer (c_int64_t) , intent(in) , value :: m
|
||||||
real*8 , intent(in) :: A(lda,*)
|
integer (c_int64_t) , intent(in) , value :: n
|
||||||
integer*8 , intent(in) :: ldb
|
real (c_double ) , intent(in) :: A(lda,*)
|
||||||
real*8 , intent(in) :: B(ldb,*)
|
integer (c_int64_t) , intent(in) , value :: lda
|
||||||
integer*8 , intent(in) :: ldc
|
real (c_double ) , intent(in) :: B(ldb,*)
|
||||||
real*8 , intent(out) :: C(ldc,*)
|
integer (c_int64_t) , intent(in) , value :: ldb
|
||||||
real*8 , intent(in) :: rescale_factor_kappa
|
real (c_double ) , intent(out) :: C(ldc,n)
|
||||||
|
integer (c_int64_t) , intent(in) , value :: ldc
|
||||||
|
real (c_double ) , intent(in) , value :: rescale_factor_kappa
|
||||||
|
integer(qmckl_exit_code) :: info
|
||||||
|
|
||||||
integer*8 :: i,j
|
integer*8 :: i,j
|
||||||
real*8 :: x, y, z, dist, rescale_factor_kappa_inv
|
real*8 :: x, y, z, dist, rescale_factor_kappa_inv
|
||||||
@ -1032,7 +1008,7 @@ integer function qmckl_distance_rescaled_f(context, transa, transb, m, n, &
|
|||||||
|
|
||||||
end select
|
end select
|
||||||
|
|
||||||
end function qmckl_distance_rescaled_f
|
end function qmckl_distance_rescaled
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** Performance
|
*** Performance
|
||||||
@ -1041,52 +1017,21 @@ end function qmckl_distance_rescaled_f
|
|||||||
|
|
||||||
** C interface :noexport:
|
** C interface :noexport:
|
||||||
|
|
||||||
#+CALL: generate_c_interface(table=qmckl_distance_rescaled_args,rettyp=get_value("FRetType"),fname=get_value("Name"))
|
#+CALL: generate_f_interface(table=qmckl_distance_rescaled_args,fname="qmckl_distance_rescaled")
|
||||||
|
|
||||||
#+RESULTS:
|
|
||||||
#+begin_src f90 :tangle (eval f) :comments org :exports none
|
|
||||||
integer(c_int32_t) function qmckl_distance_rescaled &
|
|
||||||
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc, rescale_factor_kappa) &
|
|
||||||
bind(C) result(info)
|
|
||||||
|
|
||||||
use, intrinsic :: iso_c_binding
|
|
||||||
implicit none
|
|
||||||
|
|
||||||
integer (c_int64_t) , intent(in) , value :: context
|
|
||||||
character(c_char) , intent(in) , value :: transa
|
|
||||||
character(c_char) , intent(in) , value :: transb
|
|
||||||
integer (c_int64_t) , intent(in) , value :: m
|
|
||||||
integer (c_int64_t) , intent(in) , value :: n
|
|
||||||
real (c_double ) , intent(in) :: A(lda,*)
|
|
||||||
integer (c_int64_t) , intent(in) , value :: lda
|
|
||||||
real (c_double ) , intent(in) :: B(ldb,*)
|
|
||||||
integer (c_int64_t) , intent(in) , value :: ldb
|
|
||||||
real (c_double ) , intent(out) :: C(ldc,n)
|
|
||||||
integer (c_int64_t) , intent(in) , value :: ldc
|
|
||||||
real (c_double ) , intent(in) , value :: rescale_factor_kappa
|
|
||||||
|
|
||||||
integer(c_int32_t), external :: qmckl_distance_rescaled_f
|
|
||||||
info = qmckl_distance_rescaled_f &
|
|
||||||
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc, rescale_factor_kappa)
|
|
||||||
|
|
||||||
end function qmckl_distance_rescaled
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+CALL: generate_f_interface(table=qmckl_distance_rescaled_args,rettyp=get_value("FRetType"),fname=get_value("Name"))
|
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||||
interface
|
interface
|
||||||
integer(c_int32_t) function qmckl_distance_rescaled &
|
integer(qmckl_exit_code) function qmckl_distance_rescaled &
|
||||||
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc, rescale_factor_kappa) &
|
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc, rescale_factor_kappa) &
|
||||||
bind(C)
|
bind(C)
|
||||||
use, intrinsic :: iso_c_binding
|
use, intrinsic :: iso_c_binding
|
||||||
import
|
import
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer (c_int64_t) , intent(in) , value :: context
|
integer (qmckl_context), intent(in) , value :: context
|
||||||
character(c_char) , intent(in) , value :: transa
|
character(c_char ) , intent(in) , value :: transa
|
||||||
character(c_char) , intent(in) , value :: transb
|
character(c_char ) , intent(in) , value :: transb
|
||||||
integer (c_int64_t) , intent(in) , value :: m
|
integer (c_int64_t) , intent(in) , value :: m
|
||||||
integer (c_int64_t) , intent(in) , value :: n
|
integer (c_int64_t) , intent(in) , value :: n
|
||||||
real (c_double ) , intent(in) :: A(lda,*)
|
real (c_double ) , intent(in) :: A(lda,*)
|
||||||
@ -1345,7 +1290,7 @@ end function test_qmckl_dist_rescaled
|
|||||||
| ~lda~ | ~int64_t~ | in | Leading dimension of array ~A~ |
|
| ~lda~ | ~int64_t~ | in | Leading dimension of array ~A~ |
|
||||||
| ~B~ | ~double[][ldb]~ | in | Array containing the $n \times 3$ matrix $B$ |
|
| ~B~ | ~double[][ldb]~ | in | Array containing the $n \times 3$ matrix $B$ |
|
||||||
| ~ldb~ | ~int64_t~ | in | Leading dimension of array ~B~ |
|
| ~ldb~ | ~int64_t~ | in | Leading dimension of array ~B~ |
|
||||||
| ~C~ | ~double[4][n][ldc]~ | out | Array containing the $4 \times m \times n$ matrix $C$ |
|
| ~C~ | ~double[n][ldc][4]~ | out | Array containing the $4 \times m \times n$ matrix $C$ |
|
||||||
| ~ldc~ | ~int64_t~ | in | Leading dimension of array ~C~ |
|
| ~ldc~ | ~int64_t~ | in | Leading dimension of array ~C~ |
|
||||||
| ~rescale_factor_kappa~ | ~double~ | in | Factor for calculating rescaled distances derivatives |
|
| ~rescale_factor_kappa~ | ~double~ | in | Factor for calculating rescaled distances derivatives |
|
||||||
|
|
||||||
@ -1383,21 +1328,26 @@ end function test_qmckl_dist_rescaled
|
|||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src f90 :tangle (eval f)
|
#+begin_src f90 :tangle (eval f)
|
||||||
integer function qmckl_distance_rescaled_gl_f(context, transa, transb, m, n, &
|
function qmckl_distance_rescaled_gl(context, transa, transb, m, n, &
|
||||||
A, LDA, B, LDB, C, LDC, rescale_factor_kappa) &
|
A, LDA, B, LDB, C, LDC, rescale_factor_kappa) &
|
||||||
result(info)
|
bind(C) result(info)
|
||||||
use qmckl
|
use qmckl_constants
|
||||||
|
use, intrinsic :: iso_c_binding
|
||||||
implicit none
|
implicit none
|
||||||
integer(qmckl_context) , intent(in) :: context
|
|
||||||
character , intent(in) :: transa, transb
|
integer(qmckl_exit_code) :: info
|
||||||
integer*8 , intent(in) :: m, n
|
integer (qmckl_context), intent(in) , value :: context
|
||||||
integer*8 , intent(in) :: lda
|
character(c_char ) , intent(in) , value :: transa
|
||||||
real*8 , intent(in) :: A(lda,*)
|
character(c_char ) , intent(in) , value :: transb
|
||||||
integer*8 , intent(in) :: ldb
|
integer (c_int64_t) , intent(in) , value :: m
|
||||||
real*8 , intent(in) :: B(ldb,*)
|
integer (c_int64_t) , intent(in) , value :: n
|
||||||
integer*8 , intent(in) :: ldc
|
real (c_double ) , intent(in) :: A(lda,*)
|
||||||
real*8 , intent(out) :: C(4,ldc,*)
|
integer (c_int64_t) , intent(in) , value :: lda
|
||||||
real*8 , intent(in) :: rescale_factor_kappa
|
real (c_double ) , intent(in) :: B(ldb,*)
|
||||||
|
integer (c_int64_t) , intent(in) , value :: ldb
|
||||||
|
real (c_double ) , intent(out) :: C(4,ldc,n)
|
||||||
|
integer (c_int64_t) , intent(in) , value :: ldc
|
||||||
|
real (c_double ) , intent(in) , value :: rescale_factor_kappa
|
||||||
|
|
||||||
integer*8 :: i,j
|
integer*8 :: i,j
|
||||||
real*8 :: x, y, z, dist, dist_inv
|
real*8 :: x, y, z, dist, dist_inv
|
||||||
@ -1483,7 +1433,7 @@ integer function qmckl_distance_rescaled_gl_f(context, transa, transb, m, n, &
|
|||||||
dist = dsqrt(x*x + y*y + z*z)
|
dist = dsqrt(x*x + y*y + z*z)
|
||||||
! Avoid floating-point exception
|
! Avoid floating-point exception
|
||||||
if (dist == 0.d0) then
|
if (dist == 0.d0) then
|
||||||
dist = 69.d0/rescale_factor_kappa
|
dist = 69.d0/rescale_factor_kappa
|
||||||
endif
|
endif
|
||||||
dist_inv = 1.0d0/dist
|
dist_inv = 1.0d0/dist
|
||||||
rij = dexp(-rescale_factor_kappa * dist)
|
rij = dexp(-rescale_factor_kappa * dist)
|
||||||
@ -1504,7 +1454,7 @@ integer function qmckl_distance_rescaled_gl_f(context, transa, transb, m, n, &
|
|||||||
dist = dsqrt(x*x + y*y + z*z)
|
dist = dsqrt(x*x + y*y + z*z)
|
||||||
! Avoid floating-point exception
|
! Avoid floating-point exception
|
||||||
if (dist == 0.d0) then
|
if (dist == 0.d0) then
|
||||||
dist = 69.d0/rescale_factor_kappa
|
dist = 69.d0/rescale_factor_kappa
|
||||||
endif
|
endif
|
||||||
dist_inv = 1.0d0/dist
|
dist_inv = 1.0d0/dist
|
||||||
rij = dexp(-rescale_factor_kappa * dist)
|
rij = dexp(-rescale_factor_kappa * dist)
|
||||||
@ -1525,7 +1475,7 @@ integer function qmckl_distance_rescaled_gl_f(context, transa, transb, m, n, &
|
|||||||
dist = dsqrt(x*x + y*y + z*z)
|
dist = dsqrt(x*x + y*y + z*z)
|
||||||
! Avoid floating-point exception
|
! Avoid floating-point exception
|
||||||
if (dist == 0.d0) then
|
if (dist == 0.d0) then
|
||||||
dist = 69.d0/rescale_factor_kappa
|
dist = 69.d0/rescale_factor_kappa
|
||||||
endif
|
endif
|
||||||
dist_inv = 1.0d0/dist
|
dist_inv = 1.0d0/dist
|
||||||
rij = dexp(-rescale_factor_kappa * dist)
|
rij = dexp(-rescale_factor_kappa * dist)
|
||||||
@ -1546,7 +1496,7 @@ integer function qmckl_distance_rescaled_gl_f(context, transa, transb, m, n, &
|
|||||||
dist = dsqrt(x*x + y*y + z*z)
|
dist = dsqrt(x*x + y*y + z*z)
|
||||||
! Avoid floating-point exception
|
! Avoid floating-point exception
|
||||||
if (dist == 0.d0) then
|
if (dist == 0.d0) then
|
||||||
dist = 69.d0/rescale_factor_kappa
|
dist = 69.d0/rescale_factor_kappa
|
||||||
endif
|
endif
|
||||||
dist_inv = 1.0d0/dist
|
dist_inv = 1.0d0/dist
|
||||||
rij = dexp(-rescale_factor_kappa * dist)
|
rij = dexp(-rescale_factor_kappa * dist)
|
||||||
@ -1559,64 +1509,34 @@ integer function qmckl_distance_rescaled_gl_f(context, transa, transb, m, n, &
|
|||||||
|
|
||||||
end select
|
end select
|
||||||
|
|
||||||
end function qmckl_distance_rescaled_gl_f
|
end function qmckl_distance_rescaled_gl
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
This function is more efficient when ~A~ and ~B~ are transposed.
|
This function is more efficient when ~A~ and ~B~ are transposed.
|
||||||
|
|
||||||
#+CALL: generate_c_interface(table=qmckl_distance_rescaled_gl_args,fname=get_value("Name"))
|
|
||||||
|
|
||||||
#+RESULTS:
|
|
||||||
#+begin_src f90 :tangle (eval f) :comments org :exports none
|
|
||||||
integer(c_int32_t) function qmckl_distance_rescaled_gl &
|
|
||||||
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc, rescale_factor_kappa) &
|
|
||||||
bind(C) result(info)
|
|
||||||
|
|
||||||
use, intrinsic :: iso_c_binding
|
|
||||||
implicit none
|
|
||||||
|
|
||||||
integer (c_int64_t) , intent(in) , value :: context
|
|
||||||
character(c_char) , intent(in) , value :: transa
|
|
||||||
character(c_char) , intent(in) , value :: transb
|
|
||||||
integer (c_int64_t) , intent(in) , value :: m
|
|
||||||
integer (c_int64_t) , intent(in) , value :: n
|
|
||||||
real (c_double ) , intent(in) :: A(lda,*)
|
|
||||||
integer (c_int64_t) , intent(in) , value :: lda
|
|
||||||
real (c_double ) , intent(in) :: B(ldb,*)
|
|
||||||
integer (c_int64_t) , intent(in) , value :: ldb
|
|
||||||
real (c_double ) , intent(out) :: C(ldc,n,4)
|
|
||||||
integer (c_int64_t) , intent(in) , value :: ldc
|
|
||||||
real (c_double ) , intent(in) , value :: rescale_factor_kappa
|
|
||||||
|
|
||||||
integer(c_int32_t), external :: qmckl_distance_rescaled_gl_f
|
|
||||||
info = qmckl_distance_rescaled_gl_f &
|
|
||||||
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc, rescale_factor_kappa)
|
|
||||||
|
|
||||||
end function qmckl_distance_rescaled_gl
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+CALL: generate_f_interface(table=qmckl_distance_rescaled_gl_args,rettyp=get_value("FRetType"),fname=get_value("Name"))
|
#+CALL: generate_f_interface(table=qmckl_distance_rescaled_gl_args,rettyp=get_value("FRetType"),fname=get_value("Name"))
|
||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
|
||||||
interface
|
interface
|
||||||
integer(c_int32_t) function qmckl_distance_rescaled_gl &
|
integer(qmckl_exit_code) function qmckl_distance_rescaled_gl &
|
||||||
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc, rescale_factor_kappa) &
|
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc, rescale_factor_kappa) &
|
||||||
bind(C)
|
bind(C)
|
||||||
use, intrinsic :: iso_c_binding
|
use, intrinsic :: iso_c_binding
|
||||||
import
|
import
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer (c_int64_t) , intent(in) , value :: context
|
integer (qmckl_context), intent(in) , value :: context
|
||||||
character(c_char) , intent(in) , value :: transa
|
character(c_char ) , intent(in) , value :: transa
|
||||||
character(c_char) , intent(in) , value :: transb
|
character(c_char ) , intent(in) , value :: transb
|
||||||
integer (c_int64_t) , intent(in) , value :: m
|
integer (c_int64_t) , intent(in) , value :: m
|
||||||
integer (c_int64_t) , intent(in) , value :: n
|
integer (c_int64_t) , intent(in) , value :: n
|
||||||
real (c_double ) , intent(in) :: A(lda,*)
|
real (c_double ) , intent(in) :: A(lda,*)
|
||||||
integer (c_int64_t) , intent(in) , value :: lda
|
integer (c_int64_t) , intent(in) , value :: lda
|
||||||
real (c_double ) , intent(in) :: B(ldb,*)
|
real (c_double ) , intent(in) :: B(ldb,*)
|
||||||
integer (c_int64_t) , intent(in) , value :: ldb
|
integer (c_int64_t) , intent(in) , value :: ldb
|
||||||
real (c_double ) , intent(out) :: C(ldc,n,4)
|
real (c_double ) , intent(out) :: C(4,ldc,n)
|
||||||
integer (c_int64_t) , intent(in) , value :: ldc
|
integer (c_int64_t) , intent(in) , value :: ldc
|
||||||
real (c_double ) , intent(in) , value :: rescale_factor_kappa
|
real (c_double ) , intent(in) , value :: rescale_factor_kappa
|
||||||
|
|
||||||
|
@ -35,10 +35,10 @@
|
|||||||
*** Fortran-C type conversions
|
*** Fortran-C type conversions
|
||||||
|
|
||||||
#+NAME:f_of_c
|
#+NAME:f_of_c
|
||||||
#+BEGIN_SRC python :var table=test :var rettyp="integer" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval f) :comments org :exports none"
|
#+BEGIN_SRC python :var table=test :var rettyp="qmckl_exit_code" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval f) :comments org :exports none"
|
||||||
f_of_c_d = { '' : ''
|
f_of_c_d = { '' : ''
|
||||||
, 'qmckl_context' : 'integer (c_int64_t)'
|
, 'qmckl_context' : 'integer (qmckl_context)'
|
||||||
, 'qmckl_exit_code' : 'integer (c_int32_t)'
|
, 'qmckl_exit_code' : 'integer (qmckl_exit_code)'
|
||||||
, 'bool' : 'logical*8'
|
, 'bool' : 'logical*8'
|
||||||
, 'int32_t' : 'integer (c_int32_t)'
|
, 'int32_t' : 'integer (c_int32_t)'
|
||||||
, 'int64_t' : 'integer (c_int64_t)'
|
, 'int64_t' : 'integer (c_int64_t)'
|
||||||
@ -53,8 +53,8 @@ f_of_c_d = { '' : ''
|
|||||||
#+NAME:c_of_f
|
#+NAME:c_of_f
|
||||||
#+BEGIN_SRC python :var table=test :var rettyp="integer" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval f) :comments org :exports none"
|
#+BEGIN_SRC python :var table=test :var rettyp="integer" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval f) :comments org :exports none"
|
||||||
ctypeid_d = { '' : ''
|
ctypeid_d = { '' : ''
|
||||||
, 'qmckl_context' : 'integer(c_int64_t)'
|
, 'qmckl_context' : 'integer(qmckl_context)'
|
||||||
, 'qmckl_exit_code' : 'integer(c_int32_t)'
|
, 'qmckl_exit_code' : 'integer(qmckl_exit_code)'
|
||||||
, 'integer' : 'integer(c_int32_t)'
|
, 'integer' : 'integer(c_int32_t)'
|
||||||
, 'integer*8' : 'integer(c_int64_t)'
|
, 'integer*8' : 'integer(c_int64_t)'
|
||||||
, 'real' : 'real(c_float)'
|
, 'real' : 'real(c_float)'
|
||||||
@ -164,7 +164,7 @@ return template
|
|||||||
*** Generates a C interface to the Fortran function
|
*** Generates a C interface to the Fortran function
|
||||||
|
|
||||||
#+NAME: generate_c_interface
|
#+NAME: generate_c_interface
|
||||||
#+BEGIN_SRC python :var table=[] :var rettyp="integer" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval f) :comments org :exports none"
|
#+BEGIN_SRC python :var table=[] :var rettyp="qmckl_exit_code" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval f) :comments org :exports none"
|
||||||
<<c_of_f>>
|
<<c_of_f>>
|
||||||
<<f_of_c>>
|
<<f_of_c>>
|
||||||
<<parse_table>>
|
<<parse_table>>
|
||||||
@ -220,7 +220,7 @@ return results
|
|||||||
*** Generates a Fortran interface to the C function
|
*** Generates a Fortran interface to the C function
|
||||||
|
|
||||||
#+NAME: generate_f_interface
|
#+NAME: generate_f_interface
|
||||||
#+BEGIN_SRC python :var table=test :var rettyp="integer" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval fh_func) :comments org :exports none"
|
#+BEGIN_SRC python :var table=test :var rettyp="qmckl_exit_code" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval fh_func) :comments org :exports none"
|
||||||
<<c_of_f>>
|
<<c_of_f>>
|
||||||
<<f_of_c>>
|
<<f_of_c>>
|
||||||
<<parse_table>>
|
<<parse_table>>
|
||||||
@ -269,7 +269,7 @@ return results
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+NAME: generate_private_f_interface
|
#+NAME: generate_private_f_interface
|
||||||
#+BEGIN_SRC python :var table=test :var rettyp="integer" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval fh_private_func) :comments org :exports none"
|
#+BEGIN_SRC python :var table=test :var rettyp="qmckl_exit_code" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval fh_private_func) :comments org :exports none"
|
||||||
<<c_of_f>>
|
<<c_of_f>>
|
||||||
<<f_of_c>>
|
<<f_of_c>>
|
||||||
<<parse_table>>
|
<<parse_table>>
|
||||||
|
Loading…
Reference in New Issue
Block a user