Skip to content

LAPACK error on simple SVD #325

New issue

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

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

Already on GitHub? # to your account

Closed
maximsch2 opened this issue Apr 6, 2016 · 6 comments · Fixed by JuliaLang/julia#15796
Closed

LAPACK error on simple SVD #325

maximsch2 opened this issue Apr 6, 2016 · 6 comments · Fixed by JuliaLang/julia#15796
Assignees

Comments

@maximsch2
Copy link

X = ones(Float32, (19764, 13620));
svd(X)

throws an error:

 ** On entry to SGESDDPM parameter number 12 had an illegal value
ERROR: ArgumentError: invalid argument JuliaLang/julia#12 to LAPACK call
 in gesdd! at linalg/lapack.jl:1482
 in svdfact! at linalg/svd.jl:17
 in svdfact at linalg/svd.jl:23

This sounds very close to scipy/scipy#5401, maybe we need a similar workaround?

This is on julia 0.4.5 built from source on Ubuntu 14.04.

@andreasnoack andreasnoack self-assigned this Apr 6, 2016
@andreasnoack
Copy link
Member

Ha. That's a funny one. It should be easy to work around, though. Thanks for the SciPy people.

@maximsch2
Copy link
Author

Changing places like https://github.com/JuliaLang/julia/blob/master/base/linalg/lapack.jl#L302 to

lwork = BlasInt(nextfloat(real(work[1])))

should be enough, right?

@andreasnoack
Copy link
Member

Almost. I think this would give an inexact error for smaller values so something like

lwork = round(BlasInt, nextfloat(real(work[1])))

should work. It would be great if you could make a PR.

andreasnoack referenced this issue in JuliaLang/julia Apr 10, 2016
andreasnoack referenced this issue in JuliaLang/julia Apr 10, 2016
andreasnoack referenced this issue in JuliaLang/julia Apr 11, 2016
@jianghaizhu
Copy link

Just tested it with svd(rand(Float32, (9537, 9537))), I still have this error.

** On entry to SGESDDPM parameter number 12 had an illegal value
ERROR: ArgumentError: invalid argument JuliaLang/julia#12 to LAPACK call
in gesdd! at linalg/lapack.jl:1505
in svdfact! at linalg/svd.jl:17
in svdfact at linalg/svd.jl:23

My julia version is

Julia Version 0.4.6
Commit 2e358ce (2016-06-19 17:16 UTC)
Platform Info:
System: Darwin (x86_64-apple-darwin13.4.0)
CPU: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.3

@andreasnoack
Copy link
Member

It is fixed on master but it hasn't been backported yet. I forgot to label the fix for backporting but have done that now so it should be included in next bugfix release of 0.4.

@jianghaizhu
Copy link

Great! Thanks.

tkelman referenced this issue in JuliaLang/julia Sep 13, 2016
sgesdd by using nextfloat. Now with comments and test so this commit
supersedes ad59ceb

See

http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=13&t=4587&p=11036&hilit=sgesdd#p11036

and

scipy/scipy#5401

Fixes #15784

(cherry picked from commit b6988df)
ref #15824
@KristofferC KristofferC transferred this issue from JuliaLang/julia Nov 26, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
4 participants