2
! Signatures for f2py-wrappers of FORTRAN LEVEL 1 BLAS functions.
4
! Author: Pearu Peterson
5
! Created: Jan-Feb 2002
6
! $Revision: 1181 $ $Date: 2004-11-26 06:35:43 -0700 (Fri, 26 Nov 2004) $
8
! rotg, rotmg, rot, rotm
9
! swap, scal, copy, axpy
11
! nrm2, asum, amax, iamax
13
! Not Implemented: NONE
15
! NOTE: Avoiding wrappers hack does not work under 64-bit Gentoo system
16
! with single precision routines, so they are removed.
20
subroutine <prefix>rotg(a,b,c,s)
21
! a,b are elements of a direction vector of rotated x-axis.
23
! if abs(a) + abs(b)>0:
24
! roe = abs(a)<abs(b) ? b : a
25
! r = sign(roe) * sqrt(a^2 + b^2)
32
! if 0 < abs(c) <= s: b = 1/c ! XXX: what is b when returned
35
callprotoargument <ctype>*,<ctype>*,<ctype>*,<ctype>*
37
! XXX: a and b get new values. Are they relevant?
38
<ftype> intent(in) :: a
39
<ftype> intent(in) :: b
40
<ftype> intent(out,out=c) :: c
41
<ftype> intent(out,out=s) :: s
43
end subroutine <prefix>rotg
46
! <prefix2=s,d> <ctype2=float,double> <ftype2=real,double precision>
47
subroutine <prefix2>rotmg(d1,d2,x1,y1,param)
48
! XXX: Could one give a geometrical meaning to the parameters d1,d2,x1,y1?
50
! Construct matrix H such that (H * (sqrt(d1)*x1,sqrt(d2)*y1)^T)_2 = 0.
51
! H = [[1,0],[0,1]] if param[0]==-2
52
! H = [[param[1],param[3]],[param[2],param[4]]] if param[0]==-1
53
! H = [[1,param[3]],[param[2],1]] if param[0]==0
54
! H = [[param[1],1],[-1,param[4]]] if param[0]==1
56
callstatement { (*f2py_func)(&d1,&d2,&x1,&y1,param); }
57
callprotoargument <ctype2=float,double>*,<ctype2>*,<ctype2>*,<ctype2>*,<ctype2>*
59
<ftype2> intent(in) :: d1
60
<ftype2> intent(in) :: d2
61
<ftype2> intent(in) :: x1
62
<ftype2> intent(in) :: y1
63
<ftype2> intent(out), dimension(5) :: param
64
end subroutine <prefix2>rotmg
67
subroutine <prefix><,,s,d>rot(n,x,offx,incx,y,offy,incy,c,s)
69
! Apply plane rotation
71
callstatement (*f2py_func)(&n,x+offx,&incx,y+offy,&incy,&c,&s)
72
callprotoargument int*,<ctype>*,int*,<ctype>*,int*,<ctypereal>*,<ctypereal>*
74
<ftype> dimension(*),intent(in,out,copy) :: x,y
76
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
77
integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
79
integer optional,intent(in),depend(x) :: offx=0
80
integer optional,intent(in),depend(y) :: offy=0
81
check(offx>=0 && offx<len(x)) :: offx
82
check(offy>=0 && offy<len(y)) :: offy
84
integer optional,intent(in),depend(x,incx,offx,y,incy,offy) :: n = (len(x)-offx)/abs(incx)
85
check(len(x)-offx>(n-1)*abs(incx)) :: n
86
check(len(y)-offy>(n-1)*abs(incy)) :: n
88
<ftypereal> intent(in) :: c
89
<ftypereal> intent(in) :: s
90
end subroutine <prefix><,,s,d>rot
93
subroutine <prefix2>rotm(n,x,offx,incx,y,offy,incy,param)
95
! Apply modified plane rotation
97
callstatement (*f2py_func)(&n,x+offx,&incx,y+offy,&incy,param)
98
callprotoargument int*,<ctype2>*,int*,<ctype2>*,int*,<ctype2>*
100
<ftype2> dimension(*),intent(in,out,copy) :: x,y
102
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
103
integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
105
integer optional,intent(in),depend(x) :: offx=0
106
integer optional,intent(in),depend(y) :: offy=0
107
check(offx>=0 && offx<len(x)) :: offx
108
check(offy>=0 && offy<len(y)) :: offy
110
integer optional,intent(in),depend(x,incx,offx,y,incy,offy) :: n = (len(x)-offx)/abs(incx)
111
check(len(x)-offx>(n-1)*abs(incx)) :: n
112
check(len(y)-offy>(n-1)*abs(incy)) :: n
114
<ftype2> dimension(5),intent(in) :: param
115
end subroutine <prefix2>rotm
118
subroutine <prefix>swap(n,x,offx,incx,y,offy,incy)
120
! Swap two arrays: x <-> y
122
callstatement (*f2py_func)(&n,x+offx,&incx,y+offy,&incy)
123
callprotoargument int*,<ctype>*,int*,<ctype>*,int*
125
<ftype> dimension(*),intent(in,out) :: x,y
127
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
128
integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
130
integer optional,intent(in),depend(x) :: offx=0
131
integer optional,intent(in),depend(y) :: offy=0
132
check(offx>=0 && offx<len(x)) :: offx
133
check(offy>=0 && offy<len(y)) :: offy
135
integer optional,intent(in),depend(x,incx,offx,y,incy,offy) :: n = (len(x)-offx)/abs(incx)
136
check(len(x)-offx>(n-1)*abs(incx)) :: n
137
check(len(y)-offy>(n-1)*abs(incy)) :: n
139
end subroutine <prefix>swap
141
subroutine <prefix>scal(n,a,x,offx,incx)
145
<ftype> intent(in):: a
147
callstatement (*f2py_func)(&n,&a,x+offx,&incx)
148
callprotoargument int*,<ctype>*,<ctype>*,int*
150
<ftype> dimension(*),intent(in,out) :: x
152
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
154
integer optional,intent(in),depend(x) :: offx=0
155
check(offx>=0 && offx<len(x)) :: offx
157
integer optional,intent(in),depend(x,incx,offx) :: n = (len(x)-offx)/abs(incx)
158
check(len(x)-offx>(n-1)*abs(incx)) :: n
160
end subroutine <prefix>scal
162
subroutine <_prefix2=cs,zd>scal(n,a,x,offx,incx)
166
<real,double precision> intent(in):: a
168
callstatement (*f2py_func)(&n,&a,x+offx,&incx)
169
callprotoargument int*,<float,double>*,<complex_float,complex_double>*,int*
171
<complex,double complex> dimension(*),intent(in,out,copy) :: x
173
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
175
integer optional,intent(in),depend(x) :: offx=0
176
check(offx>=0 && offx<len(x)) :: offx
178
integer optional,intent(in),depend(x,incx,offx) :: n = (len(x)-offx)/abs(incx)
179
check(len(x)-offx>(n-1)*abs(incx)) :: n
181
end subroutine <_prefix2>scal
183
subroutine <prefix>copy(n,x,offx,incx,y,offy,incy)
187
callstatement (*f2py_func)(&n,x+offx,&incx,y+offy,&incy)
188
callprotoargument int*,<ctype>*,int*,<ctype>*,int*
190
<ftype> dimension(*),intent(in) :: x
191
<ftype> dimension(*),intent(in,out) :: y
193
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
194
integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
196
integer optional,intent(in),depend(x) :: offx=0
197
integer optional,intent(in),depend(y) :: offy=0
198
check(offx>=0 && offx<len(x)) :: offx
199
check(offy>=0 && offy<len(y)) :: offy
201
integer optional,intent(in),depend(x,incx,offx,y,incy,offy) :: n = (len(x)-offx)/abs(incx)
202
check(len(x)-offx>(n-1)*abs(incx)) :: n
203
check(len(y)-offy>(n-1)*abs(incy)) :: n
205
end subroutine <prefix>copy
207
subroutine <prefix>axpy(n,a,x,offx,incx,y,offy,incy)
209
! Calculate z = a*x+y, where a is scalar.
211
callstatement (*f2py_func)(&n,&a,x+offx,&incx,y+offy,&incy)
212
callprotoargument int*,<ctype>*,<ctype>*,int*,<ctype>*,int*
214
<ftype> dimension(*),intent(in) :: x
215
<ftype> dimension(*),intent(in,out,out=z) :: y
217
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
218
integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
220
integer optional,intent(in),depend(x) :: offx=0
221
integer optional,intent(in),depend(y) :: offy=0
222
check(offx>=0 && offx<len(x)) :: offx
223
check(offy>=0 && offy<len(y)) :: offy
225
integer optional,intent(in),depend(x,incx,offx,y,incy,offy) :: n = (len(x)-offx)/abs(incx)
226
check(len(x)-offx>(n-1)*abs(incx)) :: n
227
check(len(y)-offy>(n-1)*abs(incy)) :: n
229
<ftype> optional, intent(in):: a=<1.0,\0,(1.0\,0.0),\2>
231
end subroutine <prefix>axpy
233
function <prefix2>dot(n,x,offx,incx,y,offy,incy) result (xy)
235
<ftype2> <prefix2>dot,xy
237
callstatement (*f2py_func)(&<prefix2>dot,&n,x+offx,&incx,y+offy,&incy)
238
callprotoargument <ctype2>*,int*,<ctype2>*,int*,<ctype2>*,int*
240
<ftype2> dimension(*),intent(in) :: x
241
<ftype2> dimension(*),intent(in) :: y
243
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
244
integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
246
integer optional,intent(in),depend(x) :: offx=0
247
integer optional,intent(in),depend(y) :: offy=0
248
check(offx>=0 && offx<len(x)) :: offx
249
check(offy>=0 && offy<len(y)) :: offy
251
integer optional,intent(in),depend(x,incx,offx,y,incy,offy) :: n = (len(x)-offx)/abs(incx)
252
check(len(x)-offx>(n-1)*abs(incx)) :: n
253
check(len(y)-offy>(n-1)*abs(incy)) :: n
255
end function <prefix2>dot
257
! <prefix2c=c,z> <ftype2c=complex,double complex> <ctype2c=complex_float,complex_double>
258
subroutine <prefix2c>dotu(xy,n,x,offx,incx,y,offy,incy)
260
<ftype2c> intent(out):: xy
261
fortranname w<prefix2c>dotu
263
callstatement (*f2py_func)(&xy,&n,x+offx,&incx,y+offy,&incy)
264
callprotoargument <ctype2c>*,int*,<ctype2c>*,int*,<ctype2c>*,int*
266
<ftype2c> dimension(*),intent(in) :: x
267
<ftype2c> dimension(*),intent(in) :: y
269
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
270
integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
272
integer optional,intent(in),depend(x) :: offx=0
273
integer optional,intent(in),depend(y) :: offy=0
274
check(offx>=0 && offx<len(x)) :: offx
275
check(offy>=0 && offy<len(y)) :: offy
277
integer optional,intent(in),depend(x,incx,offx,y,incy,offy) :: n = (len(x)-offx)/abs(incx)
278
check(len(x)-offx>(n-1)*abs(incx)) :: n
279
check(len(y)-offy>(n-1)*abs(incy)) :: n
281
end subroutine <prefix2c>dotu
283
subroutine <prefix2c>dotc(xy,n,x,offx,incx,y,offy,incy)
285
<ftype2c> intent (out) :: xy
286
fortranname w<prefix2c>dotc
288
callstatement (*f2py_func)(&xy,&n,x+offx,&incx,y+offy,&incy)
289
callprotoargument <ctype2c>*,int*,<ctype2c>*,int*,<ctype2c>*,int*
291
<ftype2c> dimension(*),intent(in) :: x
292
<ftype2c> dimension(*),intent(in) :: y
294
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
295
integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
297
integer optional,intent(in),depend(x) :: offx=0
298
integer optional,intent(in),depend(y) :: offy=0
299
check(offx>=0 && offx<len(x)) :: offx
300
check(offy>=0 && offy<len(y)) :: offy
302
integer optional,intent(in),depend(x,incx,offx,y,incy,offy) :: n = (len(x)-offx)/abs(incx)
303
check(len(x)-offx>(n-1)*abs(incx)) :: n
304
check(len(y)-offy>(n-1)*abs(incy)) :: n
306
end subroutine <prefix2c>dotc
308
! <prefix3=s,d,sc,dz>
309
function <prefix3>nrm2(n,x,offx,incx) result(n2)
311
<ftypereal> <prefix3>nrm2, n2
313
callstatement (*f2py_func)(&<prefix3>nrm2, &n,x+offx,&incx)
314
callprotoargument <ctypereal>*,int*,<ctype>*,int*
316
<ftype> dimension(*),intent(in) :: x
318
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
320
integer optional,intent(in),depend(x) :: offx=0
321
check(offx>=0 && offx<len(x)) :: offx
323
integer optional,intent(in),depend(x,incx,offx) :: n = (len(x)-offx)/abs(incx)
324
check(len(x)-offx>(n-1)*abs(incx)) :: n
326
end function <prefix3>nrm2
328
function <prefix3>asum(n,x,offx,incx) result (s)
330
<ftypereal> <prefix3>asum,s
332
callstatement (*f2py_func)(&<prefix3>asum,&n,x+offx,&incx)
333
callprotoargument <ctypereal>*,int*,<ctype>*,int*
335
<ftype> dimension(*),intent(in) :: x
337
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
339
integer optional,intent(in),depend(x) :: offx=0
340
check(offx>=0 && offx<len(x)) :: offx
342
integer optional,intent(in),depend(x,incx,offx) :: n = (len(x)-offx)/abs(incx)
343
check(len(x)-offx>(n-1)*abs(incx)) :: n
345
end function <prefix3>asum
347
function i<prefix>amax(n,x,offx,incx) result(k)
349
! This is to avoid Fortran wrappers.
350
integer i<prefix>amax,k
351
fortranname F_FUNC(i<prefix>amax,I<S,D,C,Z>AMAX)
352
intent(c) i<prefix>amax
354
callstatement i<prefix>amax_return_value = (*f2py_func)(&n,x+offx,&incx) - 1
355
callprotoargument int*,<ctype>*,int*
357
<ftype> dimension(*),intent(in) :: x
359
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
361
integer optional,intent(in),depend(x) :: offx=0
362
check(offx>=0 && offx<len(x)) :: offx
364
integer optional,intent(in),depend(x,incx,offx) :: n = (len(x)-offx)/abs(incx)
365
check(len(x)-offx>(n-1)*abs(incx)) :: n
367
end function i<prefix>amax