Skip to content

Commit

Permalink
Merge #875
Browse files Browse the repository at this point in the history
875: Remove eigen and eigvals adjoints for Symmetric/Hermitian r=DhairyaLGandhi a=sethaxen

JuliaDiff/ChainRules.jl#323 added rrules for `eigen` and `eigvals` for Symmetric/Hermitian matrices. This PR removes those rules from Zygote. Once the old tests pass, I'll remove them, since the rrules are more thoroughly tested.

Depends on JuliaRegistries/General#27508 is merged.

Co-authored-by: Seth Axen <[email protected]>
  • Loading branch information
bors[bot] and sethaxen authored Jan 9, 2021
2 parents 20747d6 + d747b63 commit 52bcea8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444"

[compat]
AbstractFFTs = "0.5, 1.0"
ChainRules = "0.7.34"
ChainRules = "0.7.45"
DiffRules = "1.0"
FillArrays = "0.8, 0.9, 0.10, 0.11"
ForwardDiff = "0.10"
Expand Down
26 changes: 0 additions & 26 deletions src/lib/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -570,32 +570,6 @@ end
return (Ā,)
end

@adjoint function LinearAlgebra.eigen(A::LinearAlgebra.RealHermSymComplexHerm)
dU = eigen(A)
return dU, function (Δ)
d, U = dU
d̄, Ū = Δ
if=== nothing
P = Diagonal(d̄)
else
F = inv.(d' .- d)
P = F .* (U' * Ū)
if=== nothing
P[diagind(P)] .= 0
else
P[diagind(P)] =
end
end
return (U * P * U',)
end
end

@adjoint function LinearAlgebra.eigvals(A::LinearAlgebra.RealHermSymComplexHerm)
d, U = eigen(A)
return d, d̄ -> (U * Diagonal(d̄) * U',)
end


# Hermitian/Symmetric matrix functions that can be written as power series
_realifydiag!(A::AbstractArray{<:Real}) = A
function _realifydiag!(A)
Expand Down

0 comments on commit 52bcea8

Please sign in to comment.