Skip to content

Commit 8b8cf51

Browse files
Fix _matfun for Hermitian{ComplexF64} on all Julia versions
Hermitian{ComplexF64} input with real eigenvalue output must always return Hermitian (conjugate symmetry), not Symmetric (mirror symmetry). The previous code returned Symmetric on Julia < 1.12, causing value mismatches in tests. Now the version check only applies to Hermitian{Float64} (real element type), where Julia 1.6 returns Symmetric and Julia 1.12+ returns Hermitian. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 92f126d commit 8b8cf51

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/rulesets/LinearAlgebra/symmetric.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,9 @@ function _matfun(f, A::LinearAlgebra.RealHermSymComplexHerm)
386386
elseif eltype(fλ) <: Complex
387387
# Complex input with complex output: plain Matrix
388388
fA
389-
elseif A isa Hermitian && VERSION >= v"1.12.0-DEV.0"
390-
# Julia 1.12+ returns Hermitian for Hermitian input with real output
389+
elseif A isa Hermitian && (eltype(A) <: Complex || VERSION >= v"1.12.0-DEV.0")
390+
# Complex Hermitian input with real output: always Hermitian (conjugate symmetry)
391+
# Real Hermitian input with real output: Hermitian on Julia 1.12+, Symmetric before
391392
Hermitian(fA)
392393
else
393394
Symmetric(fA)

0 commit comments

Comments
 (0)