-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LAPACKException(2) keeps happening #25
Comments
So #26 fixes your minimal reproducer but I'd be interested in knowing if it also fixes your real use cases so please comment if the issue remains after the patch release. |
Hi @andreasnoack using TSVD
I,J,K,k,n = 10,2,1,1,10000
for i = 1:n; tsvd(randn(I,K)*randn(J,K)',k); end
The frequency with which an error occurs depends on the dimensions and rank of the matrix. Playing around a bit with the following chunk of code, it seems to occur more frequently on matrices in which one of the two dimensions is small and the rank is low. I,J,K,k,n = 10,2,1,1,10000
f(A,k) = (try; tsvd(A,k); 0; catch; 1; end)
error_rate = sum([f(randn(I,K)*randn(J,K)',k) for i=1:n])/n
println("Error rate = ",error_rate)
|
Thanks for the new example. I think a proper fix here will require a some real effort. One of the new vectors is proportional to the previous basis vector so it ends as the zero vector after the axpy. I couldn't find a description of the issue in @rmlarsen's thesis but I might have missed it. Unfortunately, I don't have time to dive into the details right now, but I plan to take a closer look as soon as I have some spare cycles. |
This is an absolutely essential issue to deal with then implementing the
algorithm in finite precision arithmetic. If you study the PROPACK
implementation, you'll see the code related to this. See for example Jack
Poulson's copy of PROPACK here:
https://github.com/poulson/PROPACK/blob/master/double/dlanbpro.F#L386
(Easier than referring to my old tarball.)
Rasmus
…On Sat, Nov 7, 2020 at 12:28 PM Andreas Noack ***@***.***> wrote:
Thanks for the new example. I think a proper fix here will require a some
real effort. One of the new vectors is proportional to the previous basis
vector so it ends as the zero vector after the axpy. I couldn't find a
description of the issue in @rmlarsen <https://github.com/rmlarsen>'s
thesis but I might have missed it. Unfortunately, I don't have time to dive
into the details right now, but I plan to take a closer look as soon as I
have some spare cycles.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#25 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEA72DQI2NVH6RSIESDA6ILSOWUX7ANCNFSM4TK3JQSQ>
.
|
BTW: There are lots of little details related to estimating norms for the
stopping criterion, refining error bounds etc. that are not discussed in
their final form in the thesis.
On Sun, Nov 8, 2020 at 12:11 PM Rasmus Munk Larsen <[email protected]>
wrote:
… This is an absolutely essential issue to deal with then implementing the
algorithm in finite precision arithmetic. If you study the PROPACK
implementation, you'll see the code related to this. See for example Jack
Poulson's copy of PROPACK here:
https://github.com/poulson/PROPACK/blob/master/double/dlanbpro.F#L386
(Easier than referring to my old tarball.)
Rasmus
On Sat, Nov 7, 2020 at 12:28 PM Andreas Noack ***@***.***>
wrote:
> Thanks for the new example. I think a proper fix here will require a some
> real effort. One of the new vectors is proportional to the previous basis
> vector so it ends as the zero vector after the axpy. I couldn't find a
> description of the issue in @rmlarsen <https://github.com/rmlarsen>'s
> thesis but I might have missed it. Unfortunately, I don't have time to dive
> into the details right now, but I plan to take a closer look as soon as I
> have some spare cycles.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#25 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AEA72DQI2NVH6RSIESDA6ILSOWUX7ANCNFSM4TK3JQSQ>
> .
>
|
I'm still getting this error fyi. Has anyone tried adapting the lines of code from the PROPACK reference above to the KSVD.jl implementation? EDIT: Actually I found in my case that this happened in two cases:
if α < τ * maximum(size(A)) * eps() # orthogonalization failed, see https://github.com/poulson/PROPACK/blob/2465f89d5b1fba56de71c3e69e27d017c3dc2295/double/dlanbpro.F#L384
@warn "Restart orthogonalization"
b = V[1:(j-1)]
B = KrylovKit.OrthonormalBasis(b ./ norm.(b))
for _ in 1:3
v = rand!(v) * 2 .- 1
KrylovKit.orthonormalize!(v, B, KrylovKit.ModifiedGramSchmidt())
α = norm(v)
if !(α < τ * maximum(size(A)) * eps())
break
end
end
end This seems to fix my issue for now. |
Hi,
I've been using TSVD extensively -- thanks for this great package. However, I keep getting the following error when calling tsvd. Below is a minimal example in which failure occurs around 63% of the time. The error occurs on both Mac and Windows. Is it possible to fix this issue?
Thanks!
Jeff (@jwmi)
The text was updated successfully, but these errors were encountered: