Skip to content


R: working around “error in La.svd Lapack routine ‘dgesdd'”

That’s a quite enigmatic and unhelpful error message that apparently can be tracked down to some stuff written in *cough* Fortran (source, look for message 26).

I don’t really have a sure solution, but I did manage to evade that error with, so far, a 100% success rate. I got the error while doing some machine learning (feature selection + classification task, not sure at which step it broke), and I noticed that even though it was in a pretty large loop, it seemed to be 100% reproducible for me (loop always crashing on the same iteration). I realized that I was using set.seed() in order to get more stable results (I’m generating lots of artificial data, and having them vary between various experimental conditions adds unwanted noise), and so I thought, since this seems to usually be a random error, maybe setting another seed would work. And indeed it did: changing the seed from 100 to 99 in my case “solved” the issue.

Long story short: If it occurs randomly and you don’t use a seed, if this is a possibility do try setting a seed (try a few if it doesn’t work the first time). If it occurs deterministically and you do use a seed, try another seed value (same, try a few if needed).
If it occurs deterministically and you don’t use a seed, I’m not sure setting a seed would help. If it occurs randomly and you do use a seed, I really don’t think changing the seed would help. But I guess it costs nothing to try…

Posted in programming, R (R-project).


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.

Sorry about the CAPTCHA that requires JS. If you really don't want to enable JS and still want to comment, you can send me your comment via e-mail and I'll post it for you.

Please solve the CAPTCHA below in order to fight spamWordPress CAPTCHA