Skip to content

Commit fb95ec7

Browse files
committed
Add adjoints for converting Hermitian/Symmetric to matrix
1 parent d8decf2 commit fb95ec7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lib/array.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,11 @@ end
416416
return H, back
417417
end
418418

419+
@adjoint convert(::Type{R}, A::LinearAlgebra.HermOrSym{T,S}) where {T,S,R<:Array} = convert(R, A),
420+
Δ -> (nothing, convert(S, Δ),)
421+
@adjoint Matrix(A::LinearAlgebra.HermOrSym{T,S}) where {T,S} = Matrix(A),
422+
Δ -> (convert(S, Δ),)
423+
419424
@adjoint function cholesky::Real)
420425
C = cholesky(Σ)
421426
return C, Δ::NamedTuple->.factors[1, 1] / (2 * C.U[1, 1]),)

0 commit comments

Comments
 (0)