Skip to content

Commit

Permalink
Fix fetching parent in symmetric algebra
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub committed Oct 22, 2024
1 parent 31f7df6 commit 16cdaee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion stdlib/LinearAlgebra/src/symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,9 @@ function applytri(f, A::HermOrSym, B::HermOrSym)
f(uppertriangular(_conjugation(A)(A.data)), uppertriangular(B.data))
end
end
parentof_applytri(f, args...) = applytri(parent f, args...)
_parent_tri(U::UpperOrLowerTriangular) = parent(U)
_parent_tri(U) = U
parentof_applytri(f, args...) = _parent_tri(applytri(f, args...))

isdiag(A::HermOrSym) = applytri(isdiag, A)

Expand Down
7 changes: 7 additions & 0 deletions stdlib/LinearAlgebra/test/symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1160,4 +1160,11 @@ end
@test symT-s == Array(symT) - Array(s)
end

@testset "issue #56283" begin
a = 1.0
D = Diagonal(randn(10))
H = Hermitian(D*D')
@test a*H == H
end

end # module TestSymmetric

0 comments on commit 16cdaee

Please sign in to comment.