Skip to content

Commit

Permalink
Merge pull request #1166 from jClugstor/use_LinearAliasAPI
Browse files Browse the repository at this point in the history
Use aliasing API for linear alias specification
  • Loading branch information
ChrisRackauckas authored Feb 16, 2025
2 parents 1527a17 + f09c4a7 commit fa81c19
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/SciMLSensitivity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ using SciMLBase: SciMLBase, AbstractOverloadingSensitivityAlgorithm,
RODEFunction, RODEProblem, ReturnCode, SDEFunction,
SDEProblem, VectorContinuousCallback, deleteat!,
get_tmp_cache, has_adjoint, isinplace, reinit!, remake,
solve, u_modified!
solve, u_modified!, LinearAliasSpecifier

# AD Backends
using ChainRulesCore: unthunk, @thunk, NoTangent, @not_implemented, Tangent, ZeroTangent
Expand Down
4 changes: 2 additions & 2 deletions src/steadystate_adjoint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ end
nlprob, vec(y), (λ); autodiff = get_autodiff_from_vjp(sensealg.autojacvec))
soperator = StatefulJacobianOperator(operator, vec(λ), p)
linear_problem = LinearProblem(soperator, vec(dgdu_val); u0 = vec(λ))
solve(linear_problem, linsolve; alias_A = true, sensealg.linsolve_kwargs...)
solve(linear_problem, linsolve; alias = LinearAliasSpecifier(alias_A = true), sensealg.linsolve_kwargs...)
else
if linsolve === nothing && isempty(sensealg.linsolve_kwargs)
# For the default case use `\` to avoid any form of unnecessary cache allocation
vec(λ) .= diffcache.J' \ vec(dgdu_val)
else
linear_problem = LinearProblem(diffcache.J', vec(dgdu_val'); u0 = vec(λ))
solve(linear_problem, linsolve; alias_A = true, sensealg.linsolve_kwargs...) # u is vec(λ)
solve(linear_problem, linsolve; alias = LinearAliasSpecifier(alias_A = true), sensealg.linsolve_kwargs...) # u is vec(λ)
end
end

Expand Down

0 comments on commit fa81c19

Please sign in to comment.