Skip to content

Commit

Permalink
Merge pull request JuliaLang#10705 from JuliaLang/cjh/fix-10688-v2
Browse files Browse the repository at this point in the history
Fixup eigs warning
  • Loading branch information
jiahao committed Apr 1, 2015
2 parents 6b1346d + 9aee272 commit 3d2d84e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 4 additions & 2 deletions base/linalg/arnoldi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ function eigs(A, B;
output = ARPACK.eupd_wrapper(T, n, sym, iscmplx, bmat, nev, whichstr, ritzvec, TOL,
resid, ncv, v, ldv, sigma, iparam, ipntr, workd, workl, lworkl, rwork)

# Issue 10495: Check that all eigenvalues are converged
length(output[1]) == output[3] || warn("not all Ritz pairs are converged. Requested: $(length(output[1])), converged: $(output[3])")
# Issue 10495, 10701: Check that all eigenvalues are converged
nev = length(output[1])
nconv = output[ritzvec ? 3 : 2]
nev nconv || warn("not all wanted Ritz pairs converged. Requested: $nev, converged: $nconv")

return output
end
Expand Down
6 changes: 6 additions & 0 deletions test/linalg/arnoldi.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using Base.Test

debug = false

debug && println("eigs")
let
srand(1234)
local n,a,asym,b,bsym,d,v
Expand Down Expand Up @@ -133,6 +136,7 @@ let
@test_approx_eq eigs(speye(50), nev=10)[1] ones(10) #Issue 4246
end

debug && println("real svds")
let # svds test
A = sparse([1, 1, 2, 3, 4], [2, 1, 1, 3, 1], [2.0, -1.0, 6.1, 7.0, 1.5])
S1 = svds(A, nsv = 2)
Expand All @@ -152,13 +156,15 @@ let # svds test
@test_approx_eq s1_right s2_right

#10329
debug && println("Issue 10329")
B = sparse(diagm([1.0, 2.0, 34.0, 5.0, 6.0]))
S3 = svds(B, ritzvec=false, nsv=2)
@test_approx_eq S3[1] [34.0, 6.0]
S4 = svds(B, nsv=2)
@test_approx_eq S4[2] [34.0, 6.0]
end

debug && println("complex svds")
let # complex svds test
A = sparse([1, 1, 2, 3, 4], [2, 1, 1, 3, 1], exp(im*[2.0:2:10;]))
S1 = svds(A, nsv = 2)
Expand Down

0 comments on commit 3d2d84e

Please sign in to comment.