~ubuntu-branches/ubuntu/karmic/python-scipy/karmic

« back to all changes in this revision

Viewing changes to Lib/linalg/generic_fblas1.pyf

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T. Chen (new)
  • Date: 2005-03-16 02:15:29 UTC
  • Revision ID: james.westby@ubuntu.com-20050316021529-xrjlowsejs0cijig
Tags: upstream-0.3.2
ImportĀ upstreamĀ versionĀ 0.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
!%f90 -*- f90 -*-
 
2
! Signatures for f2py-wrappers of FORTRAN LEVEL 1 BLAS functions.
 
3
!
 
4
! Author: Pearu Peterson
 
5
! Created: Jan-Feb 2002
 
6
! $Revision: 1.7 $ $Date: 2004/10/01 10:56:40 $
 
7
 
 
8
! NOTE: Avoiding wrappers hack does not work under 64-bit Gentoo system
 
9
! with single precision routines, so they are removed.
 
10
 
 
11
! Level 1 BLAS
 
12
 
 
13
subroutine <tchar=s,d,c,z>rotg(a,b,c,s)
 
14
  ! a,b are elements of a direction vector of rotated x-axis.
 
15
 
 
16
  ! if abs(a) + abs(b)>0:
 
17
  !     roe = abs(a)<abs(b) ? b : a
 
18
  !     r = sign(roe) * sqrt(a^2 + b^2)
 
19
  !     c = a/r
 
20
  !     s = b/r
 
21
  ! else:
 
22
  !     c = 1
 
23
  !     s = r = 0
 
24
  ! a = r
 
25
  ! if 0 < abs(c) <= s: b = 1/c  ! XXX: what is b when returned
 
26
  ! else: b = s 
 
27
 
 
28
  callprotoargument <type_in_c>*,<type_in_c>*,<type_in_c>*,<type_in_c>*
 
29
 
 
30
  ! XXX: a and b get new values. Are they relevant?
 
31
  <type_in> intent(in) :: a
 
32
  <type_in> intent(in) :: b
 
33
  <type_in> intent(out,out=c) :: c
 
34
  <type_in> intent(out,out=s) :: s
 
35
 
 
36
end subroutine <tchar=s,d,c,z>rotg
 
37
 
 
38
 
 
39
subroutine <tchar=s,d>rotmg(d1,d2,x1,y1,param)
 
40
  ! XXX: Could one give a geometrical meaning to the parameters d1,d2,x1,y1?
 
41
 
 
42
  ! Construct matrix H such that (H * (sqrt(d1)*x1,sqrt(d2)*y1)^T)_2 = 0.
 
43
  ! H = [[1,0],[0,1]] if param[0]==-2
 
44
  ! H = [[param[1],param[3]],[param[2],param[4]]] if param[0]==-1
 
45
  ! H = [[1,param[3]],[param[2],1]] if param[0]==0
 
46
  ! H = [[param[1],1],[-1,param[4]]] if param[0]==1
 
47
 
 
48
  callstatement { (*f2py_func)(&d1,&d2,&x1,&y1,param); }
 
49
  callprotoargument <type_in_c>*,<type_in_c>*,<type_in_c>*,<type_in_c>*,<type_in_c>*
 
50
 
 
51
  <type_in> intent(in) :: d1
 
52
  <type_in> intent(in) :: d2
 
53
  <type_in> intent(in) :: x1
 
54
  <type_in> intent(in) :: y1
 
55
  <type_in> intent(out), dimension(5) :: param
 
56
end subroutine <tchar=s,d>rotmg
 
57
 
 
58
 
 
59
subroutine <tchar=s,d,cs,zd>rot(n,x,offx,incx,y,offy,incy,c,s)
 
60
 
 
61
  ! Apply plane rotation
 
62
 
 
63
  callstatement (*f2py_func)(&n,x+offx,&incx,y+offy,&incy,&c,&s)
 
64
  callprotoargument int*,<type_in_c>*,int*,<type_in_c>*,int*,<rtype_in_c>*,<rtype_in_c>*
 
65
 
 
66
  <type_in> dimension(*),intent(in,out,copy) :: x,y
 
67
 
 
68
  integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
 
69
  integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
 
70
 
 
71
  integer optional,intent(in),depend(x) :: offx=0
 
72
  integer optional,intent(in),depend(y) :: offy=0
 
73
  check(offx>=0 && offx<len(x)) :: offx
 
74
  check(offy>=0 && offy<len(y)) :: offy
 
75
 
 
76
  integer optional,intent(in),depend(x,incx,offx,y,incy,offy) :: n = (len(x)-offx)/abs(incx)
 
77
  check(len(x)-offx>(n-1)*abs(incx)) :: n
 
78
  check(len(y)-offy>(n-1)*abs(incy)) :: n
 
79
 
 
80
  <rtype_in> intent(in) :: c
 
81
  <rtype_in> intent(in) :: s
 
82
end subroutine <tchar=s,d,cs,zd>rot
 
83
 
 
84
 
 
85
subroutine <tchar=s,d>rotm(n,x,offx,incx,y,offy,incy,param)
 
86
 
 
87
  ! Apply modified plane rotation
 
88
 
 
89
  callstatement (*f2py_func)(&n,x+offx,&incx,y+offy,&incy,param)
 
90
  callprotoargument int*,<type_in_c>*,int*,<type_in_c>*,int*,<type_in_c>*
 
91
 
 
92
  <type_in> dimension(*),intent(in,out,copy) :: x,y
 
93
 
 
94
  integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
 
95
  integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
 
96
 
 
97
  integer optional,intent(in),depend(x) :: offx=0
 
98
  integer optional,intent(in),depend(y) :: offy=0
 
99
  check(offx>=0 && offx<len(x)) :: offx
 
100
  check(offy>=0 && offy<len(y)) :: offy
 
101
 
 
102
  integer optional,intent(in),depend(x,incx,offx,y,incy,offy) :: n = (len(x)-offx)/abs(incx)
 
103
  check(len(x)-offx>(n-1)*abs(incx)) :: n
 
104
  check(len(y)-offy>(n-1)*abs(incy)) :: n
 
105
 
 
106
  <type_in> dimension(5),intent(in) :: param
 
107
end subroutine <tchar=s,d>rotm
 
108
 
 
109
 
 
110
subroutine <tchar=s,d,c,z>swap(n,x,offx,incx,y,offy,incy)
 
111
 
 
112
  ! Swap two arrays: x <-> y
 
113
 
 
114
  callstatement (*f2py_func)(&n,x+offx,&incx,y+offy,&incy)
 
115
  callprotoargument int*,<type_in_c>*,int*,<type_in_c>*,int*
 
116
 
 
117
  <type_in> dimension(*),intent(in,out) :: x,y
 
118
 
 
119
  integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
 
120
  integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
 
121
 
 
122
  integer optional,intent(in),depend(x) :: offx=0
 
123
  integer optional,intent(in),depend(y) :: offy=0
 
124
  check(offx>=0 && offx<len(x)) :: offx
 
125
  check(offy>=0 && offy<len(y)) :: offy
 
126
 
 
127
  integer optional,intent(in),depend(x,incx,offx,y,incy,offy) :: n = (len(x)-offx)/abs(incx)
 
128
  check(len(x)-offx>(n-1)*abs(incx)) :: n
 
129
  check(len(y)-offy>(n-1)*abs(incy)) :: n
 
130
 
 
131
end subroutine <tchar=s,d,c,z>swap
 
132
 
 
133
subroutine <tchar=s,d,c,z>scal(n,a,x,offx,incx)
 
134
 
 
135
  ! Calculate y = a*x
 
136
 
 
137
  <type_in> intent(in):: a
 
138
 
 
139
  callstatement (*f2py_func)(&n,&a,x+offx,&incx)
 
140
  callprotoargument int*,<type_in_c>*,<type_in_c>*,int*
 
141
 
 
142
  <type_in> dimension(*),intent(in,out) :: x
 
143
 
 
144
  integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
 
145
 
 
146
  integer optional,intent(in),depend(x) :: offx=0
 
147
  check(offx>=0 && offx<len(x)) :: offx
 
148
 
 
149
  integer optional,intent(in),depend(x,incx,offx) :: n = (len(x)-offx)/abs(incx)
 
150
  check(len(x)-offx>(n-1)*abs(incx)) :: n
 
151
 
 
152
end subroutine <tchar=s,d,c,z>scal
 
153
 
 
154
subroutine <tchar=cs,zd>scal(n,a,x,offx,incx)
 
155
 
 
156
  ! Calculate y = a*x
 
157
 
 
158
  <rtype_in> intent(in):: a
 
159
 
 
160
  callstatement (*f2py_func)(&n,&a,x+offx,&incx)
 
161
  callprotoargument int*,<rtype_in_c>*,<type_in_c>*,int*
 
162
 
 
163
  <type_in> dimension(*),intent(in,out,copy) :: x
 
164
 
 
165
  integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
 
166
 
 
167
  integer optional,intent(in),depend(x) :: offx=0
 
168
  check(offx>=0 && offx<len(x)) :: offx
 
169
 
 
170
  integer optional,intent(in),depend(x,incx,offx) :: n = (len(x)-offx)/abs(incx)
 
171
  check(len(x)-offx>(n-1)*abs(incx)) :: n
 
172
 
 
173
end subroutine <tchar=cs,zd>scal
 
174
 
 
175
subroutine <tchar=s,d,c,z>copy(n,x,offx,incx,y,offy,incy)
 
176
 
 
177
  ! Copy y <- x
 
178
 
 
179
  callstatement (*f2py_func)(&n,x+offx,&incx,y+offy,&incy)
 
180
  callprotoargument int*,<type_in_c>*,int*,<type_in_c>*,int*
 
181
 
 
182
  <type_in> dimension(*),intent(in) :: x
 
183
  <type_in> dimension(*),intent(in,out) :: y
 
184
 
 
185
  integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
 
186
  integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
 
187
 
 
188
  integer optional,intent(in),depend(x) :: offx=0
 
189
  integer optional,intent(in),depend(y) :: offy=0
 
190
  check(offx>=0 && offx<len(x)) :: offx
 
191
  check(offy>=0 && offy<len(y)) :: offy
 
192
 
 
193
  integer optional,intent(in),depend(x,incx,offx,y,incy,offy) :: n = (len(x)-offx)/abs(incx)
 
194
  check(len(x)-offx>(n-1)*abs(incx)) :: n
 
195
  check(len(y)-offy>(n-1)*abs(incy)) :: n
 
196
 
 
197
end subroutine <tchar=s,d,c,z>copy
 
198
 
 
199
subroutine <tchar=s,d,c,z>axpy(n,a,x,offx,incx,y,offy,incy)
 
200
 
 
201
  ! Calculate z = a*x+y, where a is scalar.
 
202
 
 
203
  callstatement (*f2py_func)(&n,&a,x+offx,&incx,y+offy,&incy)
 
204
  callprotoargument int*,<type_in_c>*,<type_in_c>*,int*,<type_in_c>*,int*
 
205
 
 
206
  <type_in> dimension(*),intent(in) :: x
 
207
  <type_in> dimension(*),intent(in,out) :: y
 
208
 
 
209
  integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
 
210
  integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
 
211
 
 
212
  integer optional,intent(in),depend(x) :: offx=0
 
213
  integer optional,intent(in),depend(y) :: offy=0
 
214
  check(offx>=0 && offx<len(x)) :: offx
 
215
  check(offy>=0 && offy<len(y)) :: offy
 
216
 
 
217
  integer optional,intent(in),depend(x,incx,offx,y,incy,offy) :: n = (len(x)-offx)/abs(incx)
 
218
  check(len(x)-offx>(n-1)*abs(incx)) :: n
 
219
  check(len(y)-offy>(n-1)*abs(incy)) :: n
 
220
 
 
221
  <type_in> optional, intent(in):: a=<type_convert=1.>    
 
222
 
 
223
end subroutine <tchar=s,d,c,z>axpy
 
224
 
 
225
function <tchar=s,d>dot(n,x,offx,incx,y,offy,incy) result (xy)
 
226
 
 
227
  <type_in> <tchar=s,d>dot,xy
 
228
  
 
229
  callstatement (*f2py_func)(&<tchar=s,d>dot,&n,x+offx,&incx,y+offy,&incy)
 
230
  callprotoargument <type_in_c>*,int*,<type_in_c>*,int*,<type_in_c>*,int*
 
231
 
 
232
  <type_in> dimension(*),intent(in) :: x
 
233
  <type_in> dimension(*),intent(in) :: y
 
234
 
 
235
  integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
 
236
  integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
 
237
 
 
238
  integer optional,intent(in),depend(x) :: offx=0
 
239
  integer optional,intent(in),depend(y) :: offy=0
 
240
  check(offx>=0 && offx<len(x)) :: offx
 
241
  check(offy>=0 && offy<len(y)) :: offy
 
242
 
 
243
  integer optional,intent(in),depend(x,incx,offx,y,incy,offy) :: n = (len(x)-offx)/abs(incx)
 
244
  check(len(x)-offx>(n-1)*abs(incx)) :: n
 
245
  check(len(y)-offy>(n-1)*abs(incy)) :: n
 
246
 
 
247
end function <tchar=s,d>dot
 
248
 
 
249
subroutine <tchar=c,z>dotu(xy,n,x,offx,incx,y,offy,incy)
 
250
 
 
251
  <type_in> intent(out):: xy
 
252
  fortranname w<tchar=c,z>dotu
 
253
  
 
254
  callstatement (*f2py_func)(&xy,&n,x+offx,&incx,y+offy,&incy)
 
255
  callprotoargument <type_in_c>*,int*,<type_in_c>*,int*,<type_in_c>*,int*
 
256
 
 
257
  <type_in> dimension(*),intent(in) :: x
 
258
  <type_in> dimension(*),intent(in) :: y
 
259
 
 
260
  integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
 
261
  integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
 
262
 
 
263
  integer optional,intent(in),depend(x) :: offx=0
 
264
  integer optional,intent(in),depend(y) :: offy=0
 
265
  check(offx>=0 && offx<len(x)) :: offx
 
266
  check(offy>=0 && offy<len(y)) :: offy
 
267
 
 
268
  integer optional,intent(in),depend(x,incx,offx,y,incy,offy) :: n = (len(x)-offx)/abs(incx)
 
269
  check(len(x)-offx>(n-1)*abs(incx)) :: n
 
270
  check(len(y)-offy>(n-1)*abs(incy)) :: n
 
271
 
 
272
end subroutine <tchar=c,z>dotu
 
273
 
 
274
subroutine <tchar=c,z>dotc(xy,n,x,offx,incx,y,offy,incy)
 
275
 
 
276
  <type_in> intent (out) :: xy
 
277
  fortranname w<tchar=c,z>dotc
 
278
 
 
279
  callstatement (*f2py_func)(&xy,&n,x+offx,&incx,y+offy,&incy)
 
280
  callprotoargument <type_in_c>*,int*,<type_in_c>*,int*,<type_in_c>*,int*
 
281
 
 
282
  <type_in> dimension(*),intent(in) :: x
 
283
  <type_in> dimension(*),intent(in) :: y
 
284
 
 
285
  integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
 
286
  integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
 
287
 
 
288
  integer optional,intent(in),depend(x) :: offx=0
 
289
  integer optional,intent(in),depend(y) :: offy=0
 
290
  check(offx>=0 && offx<len(x)) :: offx
 
291
  check(offy>=0 && offy<len(y)) :: offy
 
292
 
 
293
  integer optional,intent(in),depend(x,incx,offx,y,incy,offy) :: n = (len(x)-offx)/abs(incx)
 
294
  check(len(x)-offx>(n-1)*abs(incx)) :: n
 
295
  check(len(y)-offy>(n-1)*abs(incy)) :: n
 
296
 
 
297
end subroutine <tchar=c,z>dotc
 
298
 
 
299
function <tchar=s,d,sc,dz>nrm2(n,x,offx,incx) result(n2)
 
300
 
 
301
  <type_in> <tchar=s,d,sc,dz>nrm2, n2
 
302
 
 
303
  callstatement (*f2py_func)(&<tchar=s,d,sc,dz>nrm2, &n,x+offx,&incx)
 
304
  callprotoargument <type_in_c>*,int*,<type_out_c>*,int*
 
305
 
 
306
  <type_out> dimension(*),intent(in) :: x
 
307
 
 
308
  integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
 
309
 
 
310
  integer optional,intent(in),depend(x) :: offx=0
 
311
  check(offx>=0 && offx<len(x)) :: offx
 
312
 
 
313
  integer optional,intent(in),depend(x,incx,offx) :: n = (len(x)-offx)/abs(incx)
 
314
  check(len(x)-offx>(n-1)*abs(incx)) :: n
 
315
 
 
316
end function <tchar=s,d,sc,dz>nrm2
 
317
 
 
318
function <tchar=s,d,sc,dz>asum(n,x,offx,incx) result (s)
 
319
 
 
320
  <type_in> <tchar=s,d,sc,dz>asum,s
 
321
 
 
322
  callstatement (*f2py_func)(&<tchar=s,d,sc,dz>asum,&n,x+offx,&incx)
 
323
  callprotoargument <type_in_c>*,int*,<type_out_c>*,int*
 
324
 
 
325
  <type_out> dimension(*),intent(in) :: x
 
326
 
 
327
  integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
 
328
 
 
329
  integer optional,intent(in),depend(x) :: offx=0
 
330
  check(offx>=0 && offx<len(x)) :: offx
 
331
 
 
332
  integer optional,intent(in),depend(x,incx,offx) :: n = (len(x)-offx)/abs(incx)
 
333
  check(len(x)-offx>(n-1)*abs(incx)) :: n
 
334
 
 
335
end function <tchar=s,d,sc,dz>asum
 
336
 
 
337
function i<tchar=s,d,c,z>amax(n,x,offx,incx) result(k)
 
338
 
 
339
  ! This is to avoid Fortran wrappers.
 
340
  integer i<tchar=s,d,c,z>amax,k
 
341
  fortranname F_FUNC(i<tchar=s,d,c,z>amax,I<TCHAR=S,D,C,Z>AMAX)
 
342
  intent(c) i<tchar=s,d,c,z>amax
 
343
 
 
344
  callstatement i<tchar=s,d,c,z>amax_return_value = (*f2py_func)(&n,x+offx,&incx) - 1
 
345
  callprotoargument int*,<type_out_c>*,int*
 
346
 
 
347
  <type_out> dimension(*),intent(in) :: x
 
348
 
 
349
  integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
 
350
 
 
351
  integer optional,intent(in),depend(x) :: offx=0
 
352
  check(offx>=0 && offx<len(x)) :: offx
 
353
 
 
354
  integer optional,intent(in),depend(x,incx,offx) :: n = (len(x)-offx)/abs(incx)
 
355
  check(len(x)-offx>(n-1)*abs(incx)) :: n
 
356
 
 
357
end function i<tchar=s,d,c,z>amax
 
358