Skip to content

Commit 28fb95d

Browse files
committed
BENCH: actually add gemv/gbmv f2py wrappers
1 parent 11a0c56 commit 28fb95d

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

benchmark/pybench/openblas_wrap/blas_lapack.pyf.src

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,97 @@ function <prefix4>nrm2(n,x,offx,incx) result(n2)
111111

112112
end function <prefix4>nrm2
113113

114+
115+
!
116+
! Level 2 BLAS
117+
!
118+
119+
120+
subroutine <prefix>gemv(m,n,alpha,a,x,beta,y,offx,incx,offy,incy,trans,rows,cols,ly)
121+
! Computes a matrix-vector product using a general matrix
122+
!
123+
! y = gemv(alpha,a,x,beta=0,y=0,offx=0,incx=1,offy=0,incy=0,trans=0)
124+
! Calculate y <- alpha * op(A) * x + beta * y
125+
126+
callstatement (*f2py_func)((trans?(trans==2?"C":"T"):"N"),&m,&n,&alpha,a,&m, &
127+
x+offx,&incx,&beta,y+offy,&incy)
128+
callprotoargument char*,F_INT*,F_INT*,<ctype>*,<ctype>*,F_INT*,<ctype>*,F_INT*,<ctype>*, &
129+
<ctype>*,F_INT*
130+
131+
integer optional, intent(in), check(trans>=0 && trans <=2) :: trans = 0
132+
integer optional, intent(in), check(incx>0||incx<0) :: incx = 1
133+
integer optional, intent(in), check(incy>0||incy<0) :: incy = 1
134+
<ftype> intent(in) :: alpha
135+
<ftype> intent(in), optional :: beta = <0.0,\0,(0.0\,0.0),\2>
136+
137+
<ftype> dimension(*), intent(in) :: x
138+
<ftype> dimension(ly), intent(in,copy,out), depend(ly),optional :: y
139+
integer intent(hide), depend(incy,rows,offy) :: ly = &
140+
(y_capi==Py_None?1+offy+(rows-1)*abs(incy):-1)
141+
<ftype> dimension(m,n), intent(in) :: a
142+
integer depend(a), intent(hide):: m = shape(a,0)
143+
integer depend(a), intent(hide):: n = shape(a,1)
144+
145+
integer optional, intent(in) :: offx=0
146+
integer optional, intent(in) :: offy=0
147+
check(offx>=0 && offx<len(x)) :: x
148+
check(len(x)>offx+(cols-1)*abs(incx)) :: x
149+
depend(offx,cols,incx) :: x
150+
151+
check(offy>=0 && offy<len(y)) :: y
152+
check(len(y)>offy+(rows-1)*abs(incy)) :: y
153+
depend(offy,rows,incy) :: y
154+
155+
integer depend(m,n,trans), intent(hide) :: rows = (trans?n:m)
156+
integer depend(m,n,trans), intent(hide) :: cols = (trans?m:n)
157+
158+
end subroutine <prefix>gemv
159+
160+
161+
subroutine <prefix>gbmv(m,n,kl,ku,alpha,a,lda,x,incx,offx,beta,y,incy,offy,trans,ly)
162+
! Performs one of the matrix-vector operations
163+
!
164+
! y := alpha*A*x + beta*y, or y := alpha*A**T*x + beta*y,
165+
! or y := alpha*A**H*x + beta*y,
166+
!
167+
! where alpha and beta are scalars, x and y are vectors and A is an
168+
! m by n band matrix, with kl sub-diagonals and ku super-diagonals.
169+
170+
callstatement (*f2py_func)((trans?(trans==2?"C":"T"):"N"),&m,&n,&kl,&ku,&alpha,a,&lda,x+offx,&incx,&beta,y+offy,&incy)
171+
callprotoargument char*,F_INT*,F_INT*,F_INT*,F_INT*,<ctype>*,<ctype>*,F_INT*,<ctype>*,F_INT*,<ctype>*,<ctype>*,F_INT*
172+
173+
integer optional,intent(in),check(trans>=0 && trans <=2) :: trans = 0
174+
integer intent(in), depend(ku,kl),check(m>=ku+kl+1) :: m
175+
integer intent(in),check(n>=0&&n==shape(a,1)),depend(a) :: n
176+
integer intent(in),check(kl>=0) :: kl
177+
integer intent(in),check(ku>=0) :: ku
178+
integer intent(hide),depend(a) :: lda = MAX(shape(a,0),1)
179+
integer optional, intent(in),check(incx>0||incx<0) :: incx = 1
180+
integer optional, intent(in),check(incy>0||incy<0) :: incy = 1
181+
integer intent(hide),depend(m,n,incy,offy,trans) :: ly = &
182+
(y_capi==Py_None?1+offy+(trans==0?m-1:n-1)*abs(incy):-1)
183+
integer optional, intent(in) :: offx=0
184+
integer optional, intent(in) :: offy=0
185+
186+
<ftype> intent(in) :: alpha
187+
<ftype> intent(in),optional :: beta = <0.0,\0,(0.0\,0.0),\2>
188+
189+
<ftype> dimension(lda,n),intent(in) :: a
190+
191+
<ftype> dimension(ly), intent(in,out,copy,out=yout),depend(ly),optional :: y
192+
check(offy>=0 && offy<len(y)) :: y
193+
check(len(y)>offy+(trans==0?m-1:n-1)*abs(incy)) :: y
194+
depend(offy,n,incy) :: y
195+
196+
<ftype> dimension(*), intent(in) :: x
197+
check(offx>=0 && offx<len(x)) :: x
198+
check(len(x)>offx+(trans==0?n-1:m-1)*abs(incx)) :: x
199+
depend(offx,n,incx) :: x
200+
201+
end subroutine <prefix>gbmv
202+
203+
204+
114205
!
115206
! Level 3 BLAS
116207
!

0 commit comments

Comments
 (0)