Skip to content

Commit 4ce4e20

Browse files
author
Katharine Hyatt
committed
Coverage improvements
1 parent 4daca06 commit 4ce4e20

File tree

2 files changed

+18
-28
lines changed

2 files changed

+18
-28
lines changed

src/interface/eig.jl

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,6 @@ and the diagonal matrix `D` contains the associated eigenvalues.
3535
possibly destroys the input matrix `A`. Always use the return value of the function
3636
as it may not always be possible to use the provided `DV` as output.
3737
38-
eig_full(A, B; kwargs...) -> W, V
39-
eig_full(A, B, alg::AbstractAlgorithm) -> W, V
40-
eig_full!(A, B, [WV]; kwargs...) -> W, V
41-
eig_full!(A, B, [WV], alg::AbstractAlgorithm) -> W, V
42-
43-
Compute the full generalized eigenvalue decomposition of the square matrices `A` and `B`,
44-
such that `A * V = B * V * W`, where the invertible matrix `V` contains the generalized eigenvectors
45-
and the diagonal matrix `W` contains the associated generalized eigenvalues.
46-
47-
!!! note
48-
The bang method `eig_full!` optionally accepts the output structure and
49-
possibly destroys the input matrices `A` and `B`.
50-
Always use the return value of the function as it may not always be
51-
possible to use the provided `WV` as output.
52-
5338
!!! note
5439
$(docs_eig_note)
5540
@@ -87,13 +72,6 @@ See also [`eig_full(!)`](@ref eig_full) and [`eig_vals(!)`](@ref eig_vals).
8772
eig_vals!(A, [D], alg::AbstractAlgorithm) -> D
8873
8974
Compute the list of eigenvalues of `A`.
90-
91-
eig_vals(A, B; kwargs...) -> W
92-
eig_vals(A, B, alg::AbstractAlgorithm) -> W
93-
eig_vals!(A, B, [W]; kwargs...) -> W
94-
eig_vals!(A, B, [W], alg::AbstractAlgorithm) -> W
95-
96-
Compute the list of generalized eigenvalues of `A` and `B`.
9775
9876
!!! note
9977
The bang method `eig_vals!` optionally accepts the output structure and
@@ -115,17 +93,11 @@ default_eig_algorithm(T::Type; kwargs...) = throw(MethodError(default_eig_algori
11593
function default_eig_algorithm(::Type{T}; kwargs...) where {T<:YALAPACK.BlasMat}
11694
return LAPACK_Expert(; kwargs...)
11795
end
118-
function default_eig_algorithm(::Type{TA}, ::Type{TB}; kwargs...) where {TA<:YALAPACK.BlasMat,TB<:YALAPACK.BlasMat}
119-
return LAPACK_Simple(; kwargs...)
120-
end
12196

12297
for f in (:eig_full!, :eig_vals!)
12398
@eval function default_algorithm(::typeof($f), ::Type{A}; kwargs...) where {A}
12499
return default_eig_algorithm(A; kwargs...)
125100
end
126-
@eval function default_algorithm(::typeof($f), ::Type{A}, ::Type{B}; kwargs...) where {A, B}
127-
return default_eig_algorithm(A, B; kwargs...)
128-
end
129101
end
130102

131103
function select_algorithm(::typeof(eig_trunc!), A, alg; trunc=nothing, kwargs...)

test/gen_eig.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,26 @@ using LinearAlgebra: Diagonal
2929
@test V2 === V
3030
@test A * V B * V * Diagonal(W)
3131

32+
Ac = similar(A)
33+
Bc = similar(B)
34+
W2, V2 = @constinferred gen_eig_full!(copy!(Ac, A), copy!(Bc, B), (W, V))
35+
@test W2 === W
36+
@test V2 === V
37+
@test A * V B * V * Diagonal(W)
38+
3239
Wc = @constinferred gen_eig_vals(A, B, alg′)
3340
@test eltype(Wc) == Tc
3441
@test W Diagonal(Wc)
42+
3543
end
44+
A = randn(rng, T, m, m)
45+
B = randn(rng, T, m, m)
46+
@test_throws ArgumentError("LAPACK_Expert is not supported for ggev") gen_eig_full(A, B; alg=LAPACK_Expert())
47+
@test_throws ArgumentError("LAPACK_Simple (ggev) does not accept any keyword arguments") gen_eig_full(A, B; alg=LAPACK_Simple(bad="sad"))
48+
@test_throws ArgumentError("LAPACK_Expert is not supported for ggev") gen_eig_vals(A, B; alg=LAPACK_Expert())
49+
@test_throws ArgumentError("LAPACK_Simple (ggev) does not accept any keyword arguments") gen_eig_vals(A, B; alg=LAPACK_Simple(bad="sad"))
50+
51+
# a tuple of the input types is passed to `default_algorithm`
52+
@test_throws MethodError MatrixAlgebraKit.default_algorithm(gen_eig_full, A, B)
53+
@test_throws MethodError MatrixAlgebraKit.default_algorithm(gen_eig_vals, A, B)
3654
end

0 commit comments

Comments
 (0)