Skip to content

Commit 2f57fc9

Browse files
committed
better protection agains generic linear algebra
1 parent 48db336 commit 2f57fc9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/freqresp.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ end
7575
Q = Matrix(F.Q)
7676
catch e
7777
# For matrix types that do not have a hessenberg implementation, we call the standard version of freqresp.
78-
e isa MethodError && return freqresp_nohess!(R, sys, w_vec)
78+
e isa Union{MethodError, ErrorException} && return freqresp_nohess!(R, sys, w_vec)
79+
# ErrorException appears if we try to access Q on a type which does not have Q as a field or property, notably HessenbergFactorization from GenericLinearAlgebra
7980
rethrow()
8081
end
8182
A = F.H

test/test_freqresp.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ resp2 = reshape((im*w .+ 2)./(im*w .+ 1), length(w), 1, 1)
6666
@inferred freqresp(sys2s, w)
6767
@inferred freqresp(G2, w)
6868
@inferred freqresp(H2, w)
69-
@test @allocated freqresp(sys2, w) < 1.2*305551488 # allow 20% increase due to compiler variations
69+
@test (@allocated freqresp(sys2, w)) < 1.2*56672 # allow 20% increase due to compiler variations
7070

7171

7272
## Complex-coefficient system

0 commit comments

Comments
 (0)