Skip to content

Commit 1af9ba6

Browse files
authored
Convert matrices to float in eigen (#1294)
* Convert matrices to float in `eigen` * Test for Symmetric matrix
1 parent df49024 commit 1af9ba6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/eigen.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@ end
400400
@inline eigen(A::Symmetric{<:Complex,<:StaticMatrix}; kwargs...) = _eigen(A; kwargs...)
401401

402402
@inline function _eigen(A::LinearAlgebra.HermOrSym; permute::Bool=true, scale::Bool=true)
403-
_eig(Size(A), A, permute, scale)
403+
B = convert(AbstractArray{float(eltype(A))}, A)
404+
_eig(Size(A), B, permute, scale)
404405
end
405406

406407
# NOTE: The following Boost Software License applies to parts of the method:

test/eigen.jl

+6
Original file line numberDiff line numberDiff line change
@@ -323,4 +323,10 @@ using StaticArrays, Test, LinearAlgebra
323323
@test vecs[:,1] conj.(vecs[:,2])
324324
end
325325
end
326+
327+
@testset "non-float matrix" begin
328+
A = Symmetric(SMatrix{3,3}(1:9))
329+
λ, V = eigen(A)
330+
@test A * V V * Diagonal(λ)
331+
end
326332
end

0 commit comments

Comments
 (0)