Skip to content

Commit 0d0eed9

Browse files
Merge pull request #566 from SciML/ap/linsolve_adjoint
Fix literal_getproperty for LinearSolution
2 parents 1774538 + a222cda commit 0d0eed9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SciMLBase"
22
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
33
authors = ["Chris Rackauckas <[email protected]> and contributors"]
4-
version = "2.26.2"
4+
version = "2.26.3"
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"

ext/SciMLBaseZygoteExt.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,15 @@ end
167167
sol.u, solu_adjoint
168168
end
169169

170+
@adjoint function literal_getproperty(sol::SciMLBase.LinearSolution, ::Val{:u})
171+
function solu_adjoint(Δ)
172+
zerou = zero(sol.u)
173+
= @. ifelse=== nothing, zerou, Δ)
174+
(SciMLBase.build_linear_solution(sol.cache.alg, _Δ, sol.resid, sol.cache),)
175+
end
176+
sol.u, solu_adjoint
177+
end
178+
170179
@adjoint function literal_getproperty(sol::SciMLBase.OptimizationSolution,
171180
::Val{:u})
172181
function solu_adjoint(Δ)

0 commit comments

Comments
 (0)