mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2025-01-03 18:16:28 +01:00
Fixed distances
This commit is contained in:
parent
33f33fcdf3
commit
5c285dcdb6
@ -5,6 +5,9 @@
|
|||||||
Functions for the computation of distances between particles.
|
Functions for the computation of distances between particles.
|
||||||
|
|
||||||
* Headers :noexport:
|
* Headers :noexport:
|
||||||
|
#+begin_src elisp :noexport :results none
|
||||||
|
(org-babel-lob-ingest "../tools/lib.org")
|
||||||
|
#+end_src
|
||||||
|
|
||||||
#+begin_src c :comments link :tangle (eval c_test) :noweb yes
|
#+begin_src c :comments link :tangle (eval c_test) :noweb yes
|
||||||
#include "qmckl.h"
|
#include "qmckl.h"
|
||||||
@ -37,9 +40,9 @@ MunitResult test_<<filename()>>() {
|
|||||||
| char | transb | in | Array ~B~ is ~'N'~: Normal, ~'T'~: Transposed |
|
| char | transb | in | Array ~B~ is ~'N'~: Normal, ~'T'~: Transposed |
|
||||||
| int64_t | m | in | Number of points in the first set |
|
| int64_t | m | in | Number of points in the first set |
|
||||||
| int64_t | n | in | Number of points in the second set |
|
| int64_t | n | in | Number of points in the second set |
|
||||||
| double | A[3][lda] | in | Array containing the $m \times 3$ matrix $A$ |
|
| double | A[][lda] | in | Array containing the $m \times 3$ matrix $A$ |
|
||||||
| int64_t | lda | in | Leading dimension of array ~A~ |
|
| int64_t | lda | in | Leading dimension of array ~A~ |
|
||||||
| double | B[3][ldb] | in | Array containing the $n \times 3$ matrix $B$ |
|
| double | B[][ldb] | in | Array containing the $n \times 3$ matrix $B$ |
|
||||||
| int64_t | ldb | in | Leading dimension of array ~B~ |
|
| int64_t | ldb | in | Leading dimension of array ~B~ |
|
||||||
| double | C[n][ldc] | out | Array containing the $m \times n$ matrix $C$ |
|
| double | C[n][ldc] | out | Array containing the $m \times n$ matrix $C$ |
|
||||||
| int64_t | ldc | in | Leading dimension of array ~C~ |
|
| int64_t | ldc | in | Leading dimension of array ~C~ |
|
||||||
@ -74,7 +77,7 @@ MunitResult test_<<filename()>>() {
|
|||||||
const int64_t lda,
|
const int64_t lda,
|
||||||
const double* B,
|
const double* B,
|
||||||
const int64_t ldb,
|
const int64_t ldb,
|
||||||
double* C,
|
double* const C,
|
||||||
const int64_t ldc );
|
const int64_t ldc );
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
@ -218,25 +221,26 @@ end function qmckl_distance_sq_f
|
|||||||
|
|
||||||
#+RESULTS:
|
#+RESULTS:
|
||||||
#+begin_src f90 :tangle (eval f) :comments org :exports none
|
#+begin_src f90 :tangle (eval f) :comments org :exports none
|
||||||
integer (c_int32_t) function qmckl_distance_sq &
|
integer(c_int32_t) 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) result(info)
|
bind(C) result(info)
|
||||||
|
|
||||||
use, intrinsic :: iso_c_binding
|
use, intrinsic :: iso_c_binding
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer (c_int64_t) , intent(in) :: context
|
integer (c_int64_t) , intent(in) , value :: context
|
||||||
character , intent(in) :: transa
|
character , intent(in) , value :: transa
|
||||||
character , intent(in) :: transb
|
character , intent(in) , value :: transb
|
||||||
integer (c_int64_t) , intent(in) :: m
|
integer (c_int64_t) , intent(in) , value :: m
|
||||||
integer (c_int64_t) , intent(in) :: n
|
integer (c_int64_t) , intent(in) , value :: n
|
||||||
real (c_double ) , intent(in) :: A(lda,3)
|
real (c_double ) , intent(in) :: A(lda,*)
|
||||||
integer (c_int64_t) , intent(in) :: lda
|
integer (c_int64_t) , intent(in) , value :: lda
|
||||||
real (c_double ) , intent(in) :: B(ldb,3)
|
real (c_double ) , intent(in) :: B(ldb,*)
|
||||||
integer (c_int64_t) , intent(in) :: ldb
|
integer (c_int64_t) , intent(in) , value :: ldb
|
||||||
real (c_double ) , intent(out) :: C(ldc,n)
|
real (c_double ) , intent(out) :: C(ldc,n)
|
||||||
integer (c_int64_t) , intent(in) :: ldc
|
integer (c_int64_t) , intent(in) , value :: ldc
|
||||||
|
|
||||||
integer (c_int32_t), external :: qmckl_distance_sq_f
|
integer(c_int32_t), external :: qmckl_distance_sq_f
|
||||||
info = qmckl_distance_sq_f &
|
info = qmckl_distance_sq_f &
|
||||||
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc)
|
(context, transa, transb, m, n, A, lda, B, ldb, C, ldc)
|
||||||
|
|
||||||
@ -248,24 +252,24 @@ end function qmckl_distance_sq_f
|
|||||||
#+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 (qmckl_exit_code) function qmckl_distance_sq &
|
integer(c_int32_t) 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 (qmckl_context), intent(in) :: context
|
integer (c_int64_t) , intent(in) , value :: context
|
||||||
character , intent(in) :: transa
|
character , intent(in) , value :: transa
|
||||||
character , intent(in) :: transb
|
character , intent(in) , value :: transb
|
||||||
integer (c_int64_t) , intent(in) :: m
|
integer (c_int64_t) , intent(in) , value :: m
|
||||||
integer (c_int64_t) , intent(in) :: n
|
integer (c_int64_t) , intent(in) , value :: n
|
||||||
real (c_double ) , intent(in) :: A(lda,3)
|
real (c_double ) , intent(in) :: A(lda,*)
|
||||||
integer (c_int64_t) , intent(in) :: lda
|
integer (c_int64_t) , intent(in) , value :: lda
|
||||||
real (c_double ) , intent(in) :: B(ldb,3)
|
real (c_double ) , intent(in) :: B(ldb,*)
|
||||||
integer (c_int64_t) , intent(in) :: ldb
|
integer (c_int64_t) , intent(in) , value :: ldb
|
||||||
real (c_double ) , intent(out) :: C(ldc,n)
|
real (c_double ) , intent(out) :: C(ldc,n)
|
||||||
integer (c_int64_t) , intent(in) :: ldc
|
integer (c_int64_t) , intent(in) , value :: ldc
|
||||||
|
|
||||||
end function qmckl_distance_sq
|
end function qmckl_distance_sq
|
||||||
end interface
|
end interface
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
| char | transb | in | Array ~B~ is ~'N'~: Normal, ~'T'~: Transposed |
|
| char | transb | in | Array ~B~ is ~'N'~: Normal, ~'T'~: Transposed |
|
||||||
| int64_t | m | in | Number of points in the first set |
|
| int64_t | m | in | Number of points in the first set |
|
||||||
| int64_t | n | in | Number of points in the second set |
|
| int64_t | n | in | Number of points in the second set |
|
||||||
| double | A[3][lda] | in | Array containing the $m \times 3$ matrix $A$ |
|
| double | A[][lda] | in | Array containing the $m \times 3$ matrix $A$ |
|
||||||
| int64_t | lda | in | Leading dimension of array ~A~ |
|
| int64_t | lda | in | Leading dimension of array ~A~ |
|
||||||
| double | B[3][ldb] | in | Array containing the $n \times 3$ matrix $B$ |
|
| double | B[][ldb] | in | Array containing the $n \times 3$ matrix $B$ |
|
||||||
| int64_t | ldb | in | Leading dimension of array ~B~ |
|
| int64_t | ldb | in | Leading dimension of array ~B~ |
|
||||||
| double | C[n][ldc] | out | Array containing the $m \times n$ matrix $C$ |
|
| double | C[n][ldc] | out | Array containing the $m \times n$ matrix $C$ |
|
||||||
| int64_t | ldc | in | Leading dimension of array ~C~ |
|
| int64_t | ldc | in | Leading dimension of array ~C~ |
|
||||||
@ -92,8 +92,8 @@ def parse_table(table):
|
|||||||
elif d["inout"] in ["input/output", "inout"]:
|
elif d["inout"] in ["input/output", "inout"]:
|
||||||
d["inout"] == "inout"
|
d["inout"] == "inout"
|
||||||
|
|
||||||
# Find dimensions
|
# Find dimensions (replace [] by [*] to get * in Fortran dimensions)
|
||||||
dims = d["name"].split('[')
|
dims = d["name"].replace("[]","[*]").split('[')
|
||||||
d["rank"] = len(dims) - 1
|
d["rank"] = len(dims) - 1
|
||||||
if d["rank"] == 0:
|
if d["rank"] == 0:
|
||||||
d["dims"] = []
|
d["dims"] = []
|
||||||
|
Loading…
Reference in New Issue
Block a user