Skip to content

Commit

Permalink
Merge pull request #566 from SciML/ap/linsolve_adjoint
Browse files Browse the repository at this point in the history
Fix literal_getproperty for LinearSolution
  • Loading branch information
ChrisRackauckas authored Feb 25, 2024
2 parents 1774538 + a222cda commit 0d0eed9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SciMLBase"
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
authors = ["Chris Rackauckas <[email protected]> and contributors"]
version = "2.26.2"
version = "2.26.3"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
9 changes: 9 additions & 0 deletions ext/SciMLBaseZygoteExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,15 @@ end
sol.u, solu_adjoint
end

@adjoint function literal_getproperty(sol::SciMLBase.LinearSolution, ::Val{:u})
function solu_adjoint(Δ)
zerou = zero(sol.u)
= @. ifelse=== nothing, zerou, Δ)
(SciMLBase.build_linear_solution(sol.cache.alg, _Δ, sol.resid, sol.cache),)
end
sol.u, solu_adjoint
end

@adjoint function literal_getproperty(sol::SciMLBase.OptimizationSolution,
::Val{:u})
function solu_adjoint(Δ)
Expand Down

0 comments on commit 0d0eed9

Please sign in to comment.