Skip to content

Commit 1fcf210

Browse files
kshyattKatharine Hyatt
authored andcommitted
Use TestSuite for eigh
1 parent ca99981 commit 1fcf210

8 files changed

Lines changed: 267 additions & 461 deletions

File tree

ext/MatrixAlgebraKitGenericLinearAlgebraExt.jl

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,27 @@ MatrixAlgebraKit.initialize_output(::typeof(eigh_vals!), A::AbstractMatrix, ::GL
4949

5050
function MatrixAlgebraKit.eigh_full!(A::AbstractMatrix, DV, ::GLA_QRIteration)
5151
eigval, eigvec = eigen!(Hermitian(A); sortby = real)
52-
return Diagonal(eigval::AbstractVector{real(eltype(A))}), eigvec::AbstractMatrix{eltype(A)}
52+
D, V = DV
53+
if isnothing(D)
54+
D = Diagonal(eigval::AbstractVector{real(eltype(A))})
55+
else
56+
copyto!(D, Diagonal(eigval::AbstractVector{real(eltype(A))}))
57+
end
58+
if isnothing(V)
59+
V = eigvec::AbstractMatrix{eltype(A)}
60+
else
61+
copyto!(V, eigvec::AbstractMatrix{eltype(A)})
62+
end
63+
return D, V
5364
end
5465

5566
function MatrixAlgebraKit.eigh_vals!(A::AbstractMatrix, D, ::GLA_QRIteration)
56-
return eigvals!(Hermitian(A); sortby = real)
67+
if isnothing(D)
68+
D = eigvals!(Hermitian(A); sortby = real)
69+
else
70+
copyto!(D, eigvals!(Hermitian(A); sortby = real))
71+
end
72+
return D
5773
end
5874

5975
function MatrixAlgebraKit.default_qr_algorithm(::Type{T}; kwargs...) where {T <: StridedMatrix{<:Union{Float16, ComplexF16, BigFloat, Complex{BigFloat}}}}

test/amd/eigh.jl

Lines changed: 0 additions & 105 deletions
This file was deleted.

test/cuda/eigh.jl

Lines changed: 0 additions & 118 deletions
This file was deleted.

0 commit comments

Comments
 (0)