Permalink
Browse files

fix #3966

the size of the RWORK array in zgesdd was wrong.
  • Loading branch information...
1 parent 24189fc commit 484a9f089200a9cc3cc37b30eb7c73574f719b1e @JeffBezanson JeffBezanson committed Aug 7, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 base/linalg/lapack.jl
View
3 base/linalg/lapack.jl
@@ -858,7 +858,8 @@ for (geev, gesvd, gesdd, ggsvd, elty, relty) in
S = Array($relty, minmn)
cmplx = iseltype(A,Complex)
if cmplx
- rwork = Array($relty, job == 'N' ? 7*minmn : 5*minmn*minmn + 5*minmn)
+ rwork = Array($relty, job == 'N' ? 5*minmn :
+ minmn*max(5*minmn+7, 2*max(m,n)+2*minmn+1))
@ViralBShah
ViralBShah Aug 7, 2013

Looking at the zgesdd docs, it seems like this should just be:

  rwork = Array($relty, job == 'N' ? 5*minmn : minmn*(5*minmn+7)
@JeffBezanson
JeffBezanson Aug 7, 2013

Is 5*minmn+7 always greater than 2*max(m,n)+2*minmn+1? If so, why is the comment in zgesdd written the way it is?

@vtjnash
vtjnash Aug 7, 2013

not if max(m,n) >> minmn
(edit: exact formula is 2max > 3min+6)

@ViralBShah
ViralBShah Aug 7, 2013

Oops, I was looking at version 3.1 (http://www.netlib.no/netlib/lapack/complex16/zgesdd.f). This is correct.

end
iwork = Array(BlasInt, 8*minmn)
info = Array(BlasInt, 1)

3 comments on commit 484a9f0

@Keno
The Julia Language member

This patch makes my tests segfault. Any idea why?

@kmsquire
The Julia Language member

(Just to leave a trail: #4016, 9f60588)

Please sign in to comment.