Skip to content

Loading…

incorrect lwork assertion in f2py wrapper for LAPACK xGERQF (Trac #1645) #2170

Closed
scipy-gitbot opened this Issue · 5 comments

1 participant

@scipy-gitbot

Original ticket http://projects.scipy.org/scipy/ticket/1645 on 2012-04-19 by trac user mike.wimmer, assigned to unknown.

I noticed that the f2py wrapper for xGERQF has a wrong assertion with respect to the workspace size: In lines 575-580 of flapack.pyf.src (that's the name in the current development version, in 0.10.1 where I found the mistake, it's generic_flapack.pyf.src) we see

     integer intent(hide),depend(a):: m = shape(a,0)
     integer intent(hide),depend(a):: n = shape(a,1)
     <ftype> dimension(m,n),intent(in,out,copy,out=qr,aligned8) :: a
     <ftype> dimension(MIN(m,n)),intent(out) :: tau

     integer optional,intent(in),depend(n),check(lwork>=n||lwork==-1) :: lwork=3*n

i.e. a requirement that lwork > number of columns of the array. From the LAPACK documentation however (i.e. http://www.netlib.org/lapack/double/dgerqf.f ) we find

*  LWORK   (input) INTEGER
*          The dimension of the array WORK.  LWORK >= max(1,M).

with M the number of rows.

Hence, line 580 of flapack.pyf.src should read instead

     integer optional,intent(in),depend(m),check(lwork>=m||lwork==-1) :: lwork=3*m

I discovered this problem while linking scipy to MKL, where some of the RQ tests failed because of this issue.

@scipy-gitbot

@rgommers wrote on 2012-04-22

Did you check the rest of flapack.pyf.src for this issue? There are multiple places where lwork=3*n is used.

@scipy-gitbot

trac user mike.wimmer wrote on 2012-05-03

Replying to [comment:1 rgommers]:

Did you check the rest of flapack.pyf.src for this issue? There are multiple places where lwork=3*n is used.

You are right, the same problem also exists in the xORGRQ and xUNGRQ wrappers. The rest is fine though. It's just that rows and columns are interchanged in the RQ-decomposition wrappers.

@scipy-gitbot

@rgommers wrote on 2012-05-05

Thanks for checking. If you happen to be set up with git, could you please send a pull request on Github for this? If not, I'll do it.

@scipy-gitbot

@rgommers wrote on 2012-05-20

Fixed in #222. Thanks Mike.

@scipy-gitbot

Milestone changed to 0.11.0 by @rgommers on 2012-05-20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.