Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
scipy-gitbot opened this issue Apr 25, 2013 · 5 comments
Closed
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected Migrated from Trac scipy.linalg
Milestone

Comments

@scipy-gitbot
Copy link

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
Copy link
Author

@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
Copy link
Author

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
Copy link
Author

@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
Copy link
Author

@rgommers wrote on 2012-05-20

Fixed in #222. Thanks Mike.

@scipy-gitbot
Copy link
Author

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
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected Migrated from Trac scipy.linalg
Projects
None yet
Development

No branches or pull requests

1 participant