Skip to content

Commit

Permalink
Change eigen and svd pullbacks to accept Composite{Any} (#340)
Browse files Browse the repository at this point in the history
* Release type constraints to take any Composite

* Increment version number
  • Loading branch information
sethaxen authored Jan 7, 2021
1 parent 2270522 commit 26d03d0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ChainRules"
uuid = "082447d4-558c-5d27-93f4-14fc19e9eca2"
version = "0.7.44"
version = "0.7.45"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand Down
2 changes: 1 addition & 1 deletion src/rulesets/LinearAlgebra/factorization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ end

function rrule(::typeof(eigen), A::StridedMatrix{T}; kwargs...) where {T<:Union{Real,Complex}}
F = eigen(A; kwargs...)
function eigen_pullback(ΔF::Composite{<:Eigen})
function eigen_pullback(ΔF::Composite)
λ, V = F.values, F.vectors
Δλ, ΔV = ΔF.values, ΔF.vectors
ΔV isa AbstractZero && Δλ isa AbstractZero && return (NO_FIELDS, Δλ + ΔV)
Expand Down
4 changes: 2 additions & 2 deletions src/rulesets/LinearAlgebra/symmetric.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function rrule(
kwargs...,
)
F = eigen(A; kwargs...)
function eigen_pullback(ΔF::Composite{<:Eigen})
function eigen_pullback(ΔF::Composite)
λ, U = F.values, F.vectors
Δλ, ΔU = ΔF.values, ΔF.vectors
ΔU = ΔU isa AbstractZero ? ΔU : copy(ΔU)
Expand Down Expand Up @@ -227,7 +227,7 @@ end
# is supported by reverse-mode AD packages
function rrule(::typeof(svd), A::LinearAlgebra.RealHermSymComplexHerm{<:BLAS.BlasReal,<:StridedMatrix})
F = svd(A)
function svd_pullback(ΔF::Composite{<:SVD})
function svd_pullback(ΔF::Composite)
U, V = F.U, F.V
c = _svd_eigvals_sign!(similar(F.S), U, V)
λ = F.S .* c
Expand Down

2 comments on commit 26d03d0

@sethaxen
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/27541

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.45 -m "<description of version>" 26d03d089c5f96a8d275eafd0daa6384196e95f0
git push origin v0.7.45

Please sign in to comment.