Skip to content

Commit 9492c53

Browse files
committed
Merge pull request #15824 from JuliaLang/anj/sgesdd
Redoing #15796 but now with comments and test
2 parents ecc39ac + b6988df commit 9492c53

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

base/linalg/lapack.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,6 +1572,11 @@ for (geev, gesvd, gesdd, ggsvd, elty, relty) in
15721572
end
15731573
chklapackerror(info[])
15741574
if i == 1
1575+
# Work around issue with truncated Float32 representation of lwork in
1576+
# sgesdd by using nextfloat. See
1577+
# http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=13&t=4587&p=11036&hilit=sgesdd#p11036
1578+
# and
1579+
# https://github.com/scipy/scipy/issues/5401
15751580
lwork = round(BlasInt, nextfloat(real(work[1])))
15761581
work = Array($elty, lwork)
15771582
end

test/perf/lapack/perf.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,10 @@ include("../perfutil.jl")
44

55
include("eig.jl")
66
include("factorizations.jl")
7+
8+
# The test below is not a perf test but it takes too long for the normal test suite.
9+
# This tests a work around for a bug in LAPACK where the work space is truncated
10+
# to a too small number because the number is too big to be represented as a Float32.
11+
# See the calculation for lwork in our sgesdd wrapper in lapack.jl.
12+
println("testing work space bug in sgesdd")
13+
svd(rand(Float32, 9537, 9537))

0 commit comments

Comments
 (0)