Skip to content

Commit

Permalink
fix default ncv and errors/warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jutho committed Jul 14, 2014
1 parent 32b6095 commit 8a6b879
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions base/linalg/arnoldi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using .ARPACK
eigs(A; args...) = eigs(A, I; args...)

function eigs(A, B;
nev::Integer=6, ncv::Integer=20, which::ASCIIString="LM",
nev::Integer=6, ncv::Integer=max(20,2*nev+1), which::ASCIIString="LM",
tol=0.0, maxiter::Integer=1000, sigma=nothing, v0::Vector=zeros((0,)),
ritzvec::Bool=true)

Expand All @@ -14,9 +14,19 @@ function eigs(A, B;
T = eltype(A)
iscmplx = T <: Complex
isgeneral = B !== I
sym = issym(A)
(nev = min(nev, sym ? n - 1 : n - 2)) > 0 || throw(ArgumentError("nev must be at least one"))
ncv = blas_int(min(max(2*nev + 2, ncv), n))
sym = issym(A) && !iscmplx
nevmax=sym ? n-1 : n-2
if nev > nevmax
nev = nevmax
warn("nev should be at most $nevmax")
end
nev > 0 || throw(ArgumentError("nev must be at least one"))
ncvmin = nev + (sym ? 1 : 2)
if ncv < ncvmin
warn("ncv should be at least $ncvmin")
ncv = ncvmin
end
ncv = blas_int(min(ncv, n))
isgeneral && !isposdef(B) && throw(PosDefException(0))
bmat = isgeneral ? "G" : "I"
isshift = sigma !== nothing
Expand Down

0 comments on commit 8a6b879

Please sign in to comment.