forked from scipy/scipy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fblas_l1.pyf.src
472 lines (365 loc) · 15.4 KB
/
fblas_l1.pyf.src
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
!%f90 -*- f90 -*-
! Signatures for f2py-wrappers of FORTRAN LEVEL 1 BLAS functions.
!
! Author: Pearu Peterson
! Created: Jan-Feb 2002
! Modified: Fabian Pedregosa, 2011
!
! Implemented:
!
! rotg, rotmg, rot, rotm, swap, scal, copy, axpy, dot, dotu, dotc
! nrm2, asum, amax, iamax
! NOTE: Avoiding wrappers hack does not work under 64-bit Gentoo system
! with single precision routines, so they are removed.
!
! Shorthand notations
!
! <tchar=s,d,cs,zd>
! <tchar2c=cs,zd>
!
! <prefix2=s,d>
! <prefix2c=c,z>
! <prefix3=s,sc>
! <prefix4=d,dz>
! <prefix6=s,d,c,z,c,z>
!
! <ftype2=real,double precision>
! <ftype2c=complex,double complex>
! <ftype3=real,complex>
! <ftype4=double precision,double complex>
! <ftypereal3=real,real>
! <ftypereal4=double precision,double precision>
! <ftype6=real,double precision,complex,double complex,\2,\3>
! <ftype6creal=real,double precision,complex,double complex,\0,\1>
!
! <ctype2=float,double>
! <ctype2c=complex_float,complex_double>
! <ctype3=float,complex_float>
! <ctype4=double,complex_double>
! <ctypereal3=float,float>
! <ctypereal4=double,double>
! <ctype6=float,double,complex_float,complex_double,\2,\3>
! <ctype6creal=float,double,complex_float,complex_double,\0,\1>
!
!
! Level 1 BLAS
!
subroutine <prefix>rotg(a,b,c,s)
! Computes the parameters for a Givens rotation.
!
! Given the Cartesian coordinates (a, b) of a point, these routines return
! the parameters c, s, r, and z associated with the Givens rotation. The
! parameters c and s define a unitary matrix such that:
!
! ( c s ) ( a ) ( r )
! ( ) ( ) = ( )
! (-s c ) ( b ) = ( 0 )
!
! The parameter z is defined such that if |a| > |b|, z is s; otherwise if c
! is not 0 z is 1/c; otherwise z is 1.
!
!
! Parameters
! ----------
! a : float or complex number
! Provides the x-coordinate for the point.
!
! b : float or complex number
! Provides the y-coordinate.
!
! Returns
! -------
! c, s :
! Parameter c associated with the Givens rotation.
!
! Notes
! -----
! Unlike the FORTRAN implementation, this function will not return
! parameters r and z, as these can easily be computed from the
! returned parameters.
!
callprotoargument <ctype>*,<ctype>*,<ctype>*,<ctype>*
<ftype> intent(in) :: a, b
<ftype> intent(out,out=c) :: c
<ftype> intent(out,out=s) :: s
end subroutine <prefix>rotg
subroutine <prefix2>rotmg(d1,d2,x1,y1,param)
! Computes the parameters for a modified Givens rotation.
!
! Given Cartesian coordinates (x1, y1) of an input vector, this
! routine compute the components of a modified Givens
! transformation matrix H that zeros the y-component of the
! resulting vector:
!
! [x] [sqrt(d1) x1]
! [ ] = H [ ]
! [0] [sqrt(d2) y1]
!
callstatement (*f2py_func)(&d1,&d2,&x1,&y1,param)
callprotoargument <ctype2>*,<ctype2>*,<ctype2>*,<ctype2>*,<ctype2>*
<ftype2> intent(in) :: d1, d2, x1, y1
<ftype2> intent(out), dimension(5) :: param
end subroutine <prefix2>rotmg
subroutine <tchar>rot(n,x,offx,incx,y,offy,incy,c,s)
! Applies a plane rotation with real cosine and complex sine to a
! pair of complex vectors and returns the modified vectors.
!
! x, y are input vectors and c, s are values that define a rotation:
!
! [ c s]
! [ ]
! [-conj(s) c]
!
! where c*c + s*conjg(s) = 1.0.
!
callstatement (*f2py_func)(&n,x+offx,&incx,y+offy,&incy,&c,&s)
callprotoargument int*,<ctype>*,int*,<ctype>*,int*,<ctypereal>*,<ctypereal>*
<ftype> dimension(*),intent(in,out,copy) :: x,y
<ftypereal> intent(in) :: c, s
integer optional, intent(in), check(incx>0||incx<0) :: incx = 1
integer optional, intent(in), check(incy>0||incy<0) :: incy = 1
integer optional, intent(in), depend(x) :: offx=0
integer optional, intent(in), depend(y) :: offy=0
check(offx>=0 && offx<len(x)) :: offx
check(offy>=0 && offy<len(y)) :: offy
integer optional, intent(in), depend(x,incx,offx,y,incy,offy) :: &
n = (len(x)-1-offx)/abs(incx)+1
check(len(x)-offx>(n-1)*abs(incx)) :: n
check(len(y)-offy>(n-1)*abs(incy)) :: n
end subroutine <tchar>rot
subroutine <prefix2>rotm(n,x,offx,incx,y,offy,incy,param)
! Performs rotation of points in the modified plane
!
! Given two complex vectors x and y, each vector element of these vectors is
! replaced as follows:
!
! x(i) = H*x(i) + H*y(i)
! y(i) = H*y(i) - H*x(i)
!
! where H is a modified Givens transformation matrix whose values are stored
! in the param(2) through param(5) array.
callstatement (*f2py_func)(&n,x+offx,&incx,y+offy,&incy,param)
callprotoargument int*,<ctype2>*,int*,<ctype2>*,int*,<ctype2>*
<ftype2> dimension(*), intent(in,out,copy) :: x, y
<ftype2> dimension(5), intent(in) :: param
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
integer optional, intent(in),depend(x) :: offx=0
integer optional, intent(in),depend(y) :: offy=0
check(offx>=0 && offx<len(x)) :: offx
check(offy>=0 && offy<len(y)) :: offy
integer optional, intent(in),depend(x,incx,offx,y,incy,offy) :: &
n = (len(x)-offx)/abs(incx)
check(len(x)-offx>(n-1)*abs(incx)) :: n
check(len(y)-offy>(n-1)*abs(incy)) :: n
end subroutine <prefix2>rotm
subroutine <prefix>swap(n,x,offx,incx,y,offy,incy)
! Swap two arrays: x <-> y
callstatement (*f2py_func)(&n,x+offx,&incx,y+offy,&incy)
callprotoargument int*,<ctype>*,int*,<ctype>*,int*
<ftype> dimension(*), intent(in,out) :: x, y
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
integer optional, intent(in),depend(x) :: offx=0
integer optional, intent(in),depend(y) :: offy=0
check(offx>=0 && offx<len(x)) :: offx
check(offy>=0 && offy<len(y)) :: offy
integer optional, intent(in),depend(x,incx,offx,y,incy,offy) :: &
n = (len(x)-offx)/abs(incx)
check(len(x)-offx>(n-1)*abs(incx)) :: n
check(len(y)-offy>(n-1)*abs(incy)) :: n
end subroutine <prefix>swap
subroutine <prefix>scal(n,a,x,offx,incx)
! Computes the product of a vector by a scalar: y = a*x
callstatement (*f2py_func)(&n,&a,x+offx,&incx)
callprotoargument int*,<ctype>*,<ctype>*,int*
<ftype> intent(in):: a
<ftype> dimension(*), intent(in,out) :: x
integer optional, intent(in), check(incx>0||incx<0) :: incx = 1
integer optional, intent(in), depend(x) :: offx=0
check(offx>=0 && offx<len(x)) :: offx
integer optional, intent(in),depend(x,incx,offx) :: n = (len(x)-offx)/abs(incx)
check(len(x)-offx>(n-1)*abs(incx)) :: n
end subroutine <prefix>scal
subroutine <tchar2c>scal(n,a,x,offx,incx)
! Computes the product of a vector by a scalar, scales a complex
! vector by a real constant
! y = a*x
callstatement (*f2py_func)(&n,&a,x+offx,&incx)
callprotoargument int*,<float,double>*,<complex_float, complex_double>*,int*
<real,double precision> intent(in) :: a
<complex, double complex> dimension(*), intent(in,out,copy) :: x
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
integer optional, intent(in),depend(x) :: offx=0
check(offx>=0 && offx<len(x)) :: offx
integer optional, intent(in),depend(x,incx,offx) :: n = (len(x)-offx)/abs(incx)
check(len(x)-offx>(n-1)*abs(incx)) :: n
end subroutine <tchar2c>scal
subroutine <prefix>copy(n,x,offx,incx,y,offy,incy)
! Copy y <- x
callstatement (*f2py_func)(&n,x+offx,&incx,y+offy,&incy)
callprotoargument int*,<ctype>*,int*,<ctype>*,int*
<ftype> dimension(*), intent(in) :: x
<ftype> dimension(*), intent(in,out) :: y
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
integer optional, intent(in),depend(x) :: offx=0
integer optional, intent(in),depend(y) :: offy=0
check(offx>=0 && offx<len(x)) :: offx
check(offy>=0 && offy<len(y)) :: offy
integer optional, intent(in),depend(x,incx,offx,y,incy,offy) :: &
n = (len(x)-offx)/abs(incx)
check(len(x)-offx>(n-1)*abs(incx)) :: n
check(len(y)-offy>(n-1)*abs(incy)) :: n
end subroutine <prefix>copy
subroutine <prefix>axpy(n,a,x,offx,incx,y,offy,incy)
! Calculate z = a*x+y, where a is scalar.
callstatement (*f2py_func)(&n,&a,x+offx,&incx,y+offy,&incy)
callprotoargument int*,<ctype>*,<ctype>*,int*,<ctype>*,int*
<ftype> dimension(*), intent(in) :: x
<ftype> dimension(*), intent(in,out,out=z) :: y
<ftype> optional, intent(in):: a=<1.0,\0,(1.0\,0.0),\2>
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
integer optional, intent(in),depend(x) :: offx=0
integer optional, intent(in),depend(y) :: offy=0
check(offx>=0 && offx<len(x)) :: offx
check(offy>=0 && offy<len(y)) :: offy
integer optional, intent(in),depend(x,incx,offx,y,incy,offy) :: &
n = (len(x)-offx)/abs(incx)
check(len(x)-offx>(n-1)*abs(incx)) :: n
check(len(y)-offy>(n-1)*abs(incy)) :: n
end subroutine <prefix>axpy
function sdot(n,x,offx,incx,y,offy,incy) result (xy)
! Computes a vector-vector dot product.
fortranname sdot
callstatement (*f2py_func)(&sdot,&n,x+offx,&incx,y+offy,&incy)
callprotoargument float*,int*,float*,int*,float*,int*
real dimension(*), intent(in) :: x
real dimension(*), intent(in) :: y
real sdot,xy
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
integer optional, intent(in),depend(x) :: offx=0
integer optional, intent(in),depend(y) :: offy=0
check(offx>=0 && offx<len(x)) :: offx
check(offy>=0 && offy<len(y)) :: offy
integer optional, intent(in),depend(x,incx,offx,y,incy,offy) :: &
n = (len(x)-offx)/abs(incx)
check(len(x)-offx>(n-1)*abs(incx)) :: n
check(len(y)-offy>(n-1)*abs(incy)) :: n
end function sdot
function ddot(n,x,offx,incx,y,offy,incy) result (xy)
! Computes a vector-vector dot product.
callstatement (*f2py_func)(&ddot,&n,x+offx,&incx,y+offy,&incy)
callprotoargument double*,int*,double*,int*,double*,int*
double precision dimension(*), intent(in) :: x
double precision dimension(*), intent(in) :: y
double precision ddot,xy
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
integer optional, intent(in),depend(x) :: offx=0
integer optional, intent(in),depend(y) :: offy=0
check(offx>=0 && offx<len(x)) :: offx
check(offy>=0 && offy<len(y)) :: offy
integer optional, intent(in),depend(x,incx,offx,y,incy,offy) :: &
n = (len(x)-offx)/abs(incx)
check(len(x)-offx>(n-1)*abs(incx)) :: n
check(len(y)-offy>(n-1)*abs(incy)) :: n
end function ddot
function <prefix2c>dotu(n,x,offx,incx,y,offy,incy) result(xy)
<ftype2c> :: <prefix2c>dotu, xy
fortranname w<prefix2c>dotu
callstatement (*f2py_func)(&<prefix2c>dotu,&n,x+offx,&incx,y+offy,&incy)
callprotoargument <ctype2c>*,int*,<ctype2c>*,int*,<ctype2c>*,int*
<ftype2c> dimension(*),intent(in) :: x
<ftype2c> dimension(*),intent(in) :: y
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
integer optional,intent(in),depend(x) :: offx=0
integer optional,intent(in),depend(y) :: offy=0
check(offx>=0 && offx<len(x)) :: offx
check(offy>=0 && offy<len(y)) :: offy
integer optional,intent(in),depend(x,incx,offx,y,incy,offy) &
:: n = (len(x)-offx)/abs(incx)
check(len(x)-offx>(n-1)*abs(incx)) :: n
check(len(y)-offy>(n-1)*abs(incy)) :: n
end function <prefix2c>dotu
function <prefix2c>dotc(n,x,offx,incx,y,offy,incy) result(xy)
<ftype2c> :: <prefix2c>dotc, xy
fortranname w<prefix2c>dotc
callstatement (*f2py_func)(&<prefix2c>dotc,&n,x+offx,&incx,y+offy,&incy)
callprotoargument <ctype2c>*,int*,<ctype2c>*,int*,<ctype2c>*,int*
<ftype2c> dimension(*),intent(in) :: x
<ftype2c> dimension(*),intent(in) :: y
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
integer optional,intent(in),depend(x) :: offx=0
integer optional,intent(in),depend(y) :: offy=0
check(offx>=0 && offx<len(x)) :: offx
check(offy>=0 && offy<len(y)) :: offy
integer optional,intent(in),depend(x,incx,offx,y,incy,offy) :: n = (len(x)-offx)/abs(incx)
check(len(x)-offx>(n-1)*abs(incx)) :: n
check(len(y)-offy>(n-1)*abs(incy)) :: n
end function <prefix2c>dotc
function <prefix3>nrm2(n,x,offx,incx) result(n2)
<ftypereal3> <prefix3>nrm2, n2
callstatement (*f2py_func)(&<prefix3>nrm2, &n,x+offx,&incx)
callprotoargument <ctypereal3>*,int*,<ctype3>*,int*
<ftype3> dimension(*),intent(in) :: x
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
integer optional,intent(in),depend(x) :: offx=0
check(offx>=0 && offx<len(x)) :: offx
integer optional,intent(in),depend(x,incx,offx) :: n = (len(x)-offx)/abs(incx)
check(len(x)-offx>(n-1)*abs(incx)) :: n
end function <prefix3>nrm2
function <prefix4>nrm2(n,x,offx,incx) result(n2)
<ftypereal4> <prefix4>nrm2, n2
callstatement (*f2py_func)(&<prefix4>nrm2, &n,x+offx,&incx)
callprotoargument <ctypereal4>*,int*,<ctype4>*,int*
<ftype4> dimension(*),intent(in) :: x
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
integer optional,intent(in),depend(x) :: offx=0
check(offx>=0 && offx<len(x)) :: offx
integer optional,intent(in),depend(x,incx,offx) :: n = (len(x)-offx)/abs(incx)
check(len(x)-offx>(n-1)*abs(incx)) :: n
end function <prefix4>nrm2
function <prefix3>asum(n,x,offx,incx) result (s)
! Computes the sum of magnitudes of the vector elements
callstatement (*f2py_func)(&<prefix3>asum,&n,x+offx,&incx)
callprotoargument <ctypereal3>*,int*,<ctype3>*,int*
<ftype3> dimension(*), intent(in) :: x
<ftypereal3> <prefix3>asum,s
integer optional, intent(in), check(incx>0||incx<0) :: incx = 1
integer optional, intent(in), depend(x) :: offx=0
check(offx>=0 && offx<len(x)) :: offx
integer optional, intent(in),depend(x,incx,offx) :: n = (len(x)-offx)/abs(incx)
check(len(x)-offx>(n-1)*abs(incx)) :: n
end function <prefix3>asum
function <prefix4>asum(n,x,offx,incx) result (s)
! Computes the sum of magnitudes of the vector elements
callstatement (*f2py_func)(&<prefix4>asum,&n,x+offx,&incx)
callprotoargument <ctypereal4>*,int*,<ctype4>*,int*
<ftype4> dimension(*), intent(in) :: x
<ftypereal4> <prefix4>asum,s
integer optional, intent(in), check(incx>0||incx<0) :: incx = 1
integer optional, intent(in), depend(x) :: offx=0
check(offx>=0 && offx<len(x)) :: offx
integer optional, intent(in),depend(x,incx,offx) :: n = (len(x)-offx)/abs(incx)
check(len(x)-offx>(n-1)*abs(incx)) :: n
end function <prefix4>asum
function i<prefix>amax(n,x,offx,incx) result(k)
! Finds the index of the element with maximum absolute value.
callstatement i<prefix>amax_return_value = (*f2py_func)(&n,x+offx,&incx) - 1
callprotoargument int*,<ctype>*,int*
! This is to avoid Fortran wrappers.
integer i<prefix>amax,k
fortranname F_FUNC(i<prefix>amax,I<S,D,C,Z>AMAX)
intent(c) i<prefix>amax
<ftype> dimension(*), intent(in) :: x
integer optional, intent(in), check(incx>0||incx<0) :: incx = 1
integer optional, intent(in), depend(x) :: offx=0
check(offx>=0 && offx<len(x)) :: offx
integer optional, intent(in),depend(x,incx,offx) :: n = (len(x)-offx)/abs(incx)
check(len(x)-offx>(n-1)*abs(incx)) :: n
end function i<prefix>amax