Skip to content

Commit a71dd05

Browse files
committed
Revert "Materialize complex Symmetric matrices in eigen (#55348)"
This reverts commit c28dc85.
1 parent b5eaa97 commit a71dd05

File tree

4 files changed

+6
-23
lines changed

4 files changed

+6
-23
lines changed

stdlib/LinearAlgebra/src/bunchkaufman.jl

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ function bunchkaufman!(A::StridedMatrix{<:BlasFloat}, rook::Bool = false; check:
127127
end
128128
end
129129

130-
bkcopy_oftype(A, S) = eigencopy_oftype(A, S)
131-
bkcopy_oftype(A::Symmetric{<:Complex}, S) = Symmetric(copytrito!(similar(parent(A), S, size(A)), A.data, A.uplo), sym_uplo(A.uplo))
132-
133130
"""
134131
bunchkaufman(A, rook::Bool=false; check = true) -> S::BunchKaufman
135132
@@ -209,7 +206,7 @@ julia> S.L*S.D*S.L' - A[S.p, S.p]
209206
```
210207
"""
211208
bunchkaufman(A::AbstractMatrix{T}, rook::Bool=false; check::Bool = true) where {T} =
212-
bunchkaufman!(bkcopy_oftype(A, typeof(sqrt(oneunit(T)))), rook; check = check)
209+
bunchkaufman!(eigencopy_oftype(A, typeof(sqrt(oneunit(T)))), rook; check = check)
213210

214211
BunchKaufman{T}(B::BunchKaufman) where {T} =
215212
BunchKaufman(convert(Matrix{T}, B.LD), B.ipiv, B.uplo, B.symmetric, B.rook, B.info)
@@ -1532,7 +1529,7 @@ function bunchkaufman(A::AbstractMatrix{TS},
15321529
rook::Bool = false;
15331530
check::Bool = true
15341531
) where TS <: ClosedScalar{TR} where TR <: ClosedReal
1535-
return bunchkaufman!(bkcopy_oftype(A, TS), rook; check)
1532+
return bunchkaufman!(eigencopy_oftype(A, TS), rook; check)
15361533
end
15371534

15381535
function bunchkaufman(A::AbstractMatrix{TS},
@@ -1554,15 +1551,15 @@ function bunchkaufman(A::AbstractMatrix{TS},
15541551
# We promote input to BigInt to avoid overflow problems
15551552
if TA == Nothing
15561553
if TS <: Integer
1557-
M = Rational{BigInt}.(bkcopy_oftype(A, TS))
1554+
M = Rational{BigInt}.(eigencopy_oftype(A, TS))
15581555
else
1559-
M = Complex{Rational{BigInt}}.(bkcopy_oftype(A, TS))
1556+
M = Complex{Rational{BigInt}}.(eigencopy_oftype(A, TS))
15601557
end
15611558
else
15621559
if TS <: Integer
1563-
M = TA(Rational{BigInt}.(bkcopy_oftype(A, TS)), Symbol(A.uplo))
1560+
M = TA(Rational{BigInt}.(eigencopy_oftype(A, TS)), Symbol(A.uplo))
15641561
else
1565-
M = TA(Complex{Rational{BigInt}}.(bkcopy_oftype(A, TS)),
1562+
M = TA(Complex{Rational{BigInt}}.(eigencopy_oftype(A, TS)),
15661563
Symbol(A.uplo))
15671564
end
15681565
end

stdlib/LinearAlgebra/src/symmetriceigen.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# preserve HermOrSym wrapper
44
eigencopy_oftype(A::Hermitian, S) = Hermitian(copy_similar(A, S), sym_uplo(A.uplo))
55
eigencopy_oftype(A::Symmetric, S) = Symmetric(copy_similar(A, S), sym_uplo(A.uplo))
6-
eigencopy_oftype(A::Symmetric{<:Complex}, S) = copyto!(similar(parent(A), S), A)
76

87
# Eigensolvers for symmetric and Hermitian matrices
98
eigen!(A::RealHermSymComplexHerm{<:BlasReal,<:StridedMatrix}; sortby::Union{Function,Nothing}=nothing) =

stdlib/LinearAlgebra/test/hessenberg.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,4 @@ end
250250
@test axes(S) === (r,r)
251251
end
252252

253-
@testset "complex Symmetric" begin
254-
D = diagm(0=>ComplexF64[1,2])
255-
S = Symmetric(D)
256-
H = hessenberg(S)
257-
@test H.H == D
258-
end
259-
260253
end # module TestHessenberg

stdlib/LinearAlgebra/test/symmetriceigen.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,4 @@ end
151151
@test HT * V V * Diagonal(λ)
152152
end
153153

154-
@testset "complex Symmetric" begin
155-
S = Symmetric(rand(ComplexF64,2,2))
156-
λ, v = eigen(S)
157-
@test S * v v * Diagonal(λ)
158-
end
159-
160154
end # module TestSymmetricEigen

0 commit comments

Comments
 (0)