Permalink
Browse files

Match Octave/Numpy's minimum RWORK size for gesdd. Fixes #4016

gesdd's RWORK size was recently changed to match the netlib header.
However, the minimum size calculated results in a segfault.  Both
Octave and Numpy use a different minimum size, and testing verified
that anything smaller than this leads to a segfault.

Numpy: https://github.com/numpy/numpy/blob/master/numpy/linalg/umath_linalg.c.src#L2922
Octave: http://hg.savannah.gnu.org/hgweb/octave/file/2f1729cae08f/liboctave/numeric/CmplxSVD.cc#l184
  • Loading branch information...
1 parent 3134f78 commit 9f6058804ca2b7edd481a316b5fca7e13a743479 @kmsquire kmsquire committed Aug 13, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 base/linalg/lapack.jl
View
@@ -858,7 +858,7 @@ for (geev, gesvd, gesdd, ggsvd, elty, relty) in
S = Array($relty, minmn)
cmplx = iseltype(A,Complex)
if cmplx
- rwork = Array($relty, job == 'N' ? 5*minmn :
+ rwork = Array($relty, job == 'N' ? 7*minmn :
minmn*max(5*minmn+7, 2*max(m,n)+2*minmn+1))
end
iwork = Array(BlasInt, 8*minmn)

5 comments on commit 9f60588

Owner

ViralBShah replied Aug 13, 2013

@kmsquire Thanks for tracking this down. I just committed patches to dlasd4 and slasd4 as well as part of #2430 - but you have rebuild openblas if you want these fixes. Hopefully with all of this will make our SVD bugfree.

Owner

ViralBShah replied Aug 13, 2013

Looking at the Numpy and octave wrappers, I feel that our wrappers are considerably simpler and easier to hack.

Member

kmsquire replied Aug 13, 2013

Hmm. Looking at 484a9f0, matching Numpy and Octave was kind of irrelevant, because we used to have exactly what they have. Either way, the 7*minnm needs to be there.

Member

kmsquire replied Aug 13, 2013

@ViralBShah, hopefully so! I think you meant #2340. Cheers!

Please sign in to comment.