Skip to content

Commit df3491e

Browse files
committed
Make automatic specrange less noisy
We can just silently fall back on Arnoldi if an operator is not an Array. Note that the `size` method is part of the operator interface, so that should definitely produce a warning (that is never triggered for "proper" operators)
1 parent 22d8eb2 commit df3491e

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/specrad.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,16 @@ function specrange(H, method::Val{:auto}; kwargs...)
4646
if haskey(kwargs, :E_min) && haskey(kwargs, :E_max)
4747
return specrange(H, Val(:manual); kwargs...)
4848
end
49-
if hasmethod(size, (typeof(H),)) && hasmethod(Array, (typeof(H),))
49+
if hasmethod(size, (typeof(H),))
5050
if size(H)[1] <= 32
5151
# TODO: benchmark what a good cross-over point from exact
5252
# diagonalization to Arnoldi is
53-
return specrange(H, Val(:diag); kwargs...)
53+
if hasmethod(Array, (typeof(H),))
54+
return specrange(H, Val(:diag); kwargs...)
55+
end
5456
end
5557
else
56-
@warn "`size(H)` and `Array(H)` are not implemented for $(typeof(H))"
58+
@warn "`size(H)` not implemented for $(typeof(H))"
5759
end
5860
return specrange(H, Val(:arnoldi); kwargs...)
5961
end

0 commit comments

Comments
 (0)