4
c All Fortran functions returning a complex or double complex type must
5
c be defined here with a corresponding C subroutine e.g. (Fortran) complex
6
c function ga_cdot --> (C) void gai_cdot(..., SingleComplex *ret).
8
c from http://www.math.utah.edu/software/c-with-fortran.html
11
c Function return types
13
c Unfortunately, returning composite objects that occupy more than a
14
c single register, or an adjacent register pair, is fraught with peril.
15
c Older C and C++ compilers did not support this at all, and newer ones
16
c may do it differently than Fortran compilers do: thus, you should not
17
c expect to use Fortran functions that return types such as COMPLEX or
18
c COMPLEX*16. Write a SUBROUTINE interface to your Fortran function
19
c instead, and then invoke it as a void function from C or C++.
22
c We attempted to use various calling conventions, argument order,
23
c hidden first arguments as the return, etc to eliminate the need
24
c for any Fortran source such as this, but portability was an issue.
25
c Intel compilers did not behave similarly to GCC or Pathscale. At a
26
c later date perhaps we will revisit this.
28
c For the time being, any function returning a complex type must be
29
c defined here following the established convention herein.
31
complex function ga_cdot(g_a,g_b)
36
call gai_cdot(g_a,g_b,ga_cdot)
39
complex function nga_cdot(g_a,g_b)
44
call ngai_cdot(g_a,g_b,nga_cdot)
47
double complex function ga_zdot(g_a,g_b)
52
call gai_zdot(g_a,g_b,ga_zdot)
55
double complex function nga_zdot(g_a,g_b)
60
call ngai_zdot(g_a,g_b,nga_zdot)
63
complex function ga_cdot_patch(
64
$ g_a, t_a, ailo, aihi, ajlo, ajhi,
65
$ g_b, t_b, bilo, bihi, bjlo, bjhi)
67
integer g_a, ailo, aihi, ajlo, ajhi
68
integer g_b, bilo, bihi, bjlo, bjhi
70
external gai_cdot_patch
71
ga_cdot_patch = (0.,0.)
73
$ g_a, t_a, ailo, aihi, ajlo, ajhi,
74
$ g_b, t_b, bilo, bihi, bjlo, bjhi, ga_cdot_patch)
77
complex function nga_cdot_patch(
84
external ngai_cdot_patch
85
nga_cdot_patch = (0.,0.)
88
$ g_b, t_b, blo, bhi, nga_cdot_patch)
91
double complex function ga_zdot_patch(
92
$ g_a, t_a, ailo, aihi, ajlo, ajhi,
93
$ g_b, t_b, bilo, bihi, bjlo, bjhi)
95
integer g_a, ailo, aihi, ajlo, ajhi
96
integer g_b, bilo, bihi, bjlo, bjhi
98
external gai_zdot_patch
99
ga_zdot_patch = (0.,0.)
101
$ g_a, t_a, ailo, aihi, ajlo, ajhi,
102
$ g_b, t_b, bilo, bihi, bjlo, bjhi, ga_zdot_patch)
105
double complex function nga_zdot_patch(
106
$ g_a, t_a, alo, ahi,
107
$ g_b, t_b, blo, bhi)
109
integer g_a, alo, ahi
110
integer g_b, blo, bhi
112
external ngai_zdot_patch
113
nga_zdot_patch = (0.,0.)
114
call ngai_zdot_patch(
115
$ g_a, t_a, alo, ahi,
116
$ g_b, t_b, blo, bhi, nga_zdot_patch)