6565__issquare (assump:: OperatorAssumptions ) = assump. issq
6666__conditioning (assump:: OperatorAssumptions ) = assump. condition
6767
68- mutable struct LinearCache{TA, Tb, Tu, Tp, Talg, Tc, Tl, Tr, Ttol, issq}
68+ mutable struct LinearCache{TA, Tb, Tu, Tp, Talg, Tc, Tl, Tr, Ttol, issq, S }
6969 A:: TA
7070 b:: Tb
7171 u:: Tu
@@ -80,6 +80,7 @@ mutable struct LinearCache{TA, Tb, Tu, Tp, Talg, Tc, Tl, Tr, Ttol, issq}
8080 maxiters:: Int
8181 verbose:: Bool
8282 assumptions:: OperatorAssumptions{issq}
83+ sensealg:: S
8384end
8485
8586function Base. setproperty! (cache:: LinearCache , name:: Symbol , x)
@@ -138,6 +139,7 @@ function SciMLBase.init(prob::LinearProblem, alg::SciMLLinearSolveAlgorithm,
138139 Pl = IdentityOperator (size (prob. A)[1 ]),
139140 Pr = IdentityOperator (size (prob. A)[2 ]),
140141 assumptions = OperatorAssumptions (issquare (prob. A)),
142+ sensealg = LinearSolveAdjoint (),
141143 kwargs... )
142144 @unpack A, b, u0, p = prob
143145
@@ -171,17 +173,22 @@ function SciMLBase.init(prob::LinearProblem, alg::SciMLLinearSolveAlgorithm,
171173 Tc = typeof (cacheval)
172174
173175 cache = LinearCache{typeof (A), typeof (b), typeof (u0_), typeof (p), typeof (alg), Tc,
174- typeof (Pl), typeof (Pr), typeof (reltol), typeof (assumptions. issq)}(A, b, u0_,
175- p, alg, cacheval, isfresh, Pl, Pr, abstol, reltol, maxiters, verbose, assumptions)
176+ typeof (Pl), typeof (Pr), typeof (reltol), typeof (assumptions. issq),
177+ typeof (sensealg)}(A, b, u0_, p, alg, cacheval, isfresh, Pl, Pr, abstol, reltol,
178+ maxiters, verbose, assumptions, sensealg)
176179 return cache
177180end
178181
179182function SciMLBase. solve (prob:: LinearProblem , args... ; kwargs... )
180- solve! ( init ( prob, nothing , args... ; kwargs... ) )
183+ return solve ( prob, nothing , args... ; kwargs... )
181184end
182185
183- function SciMLBase. solve (prob:: LinearProblem ,
184- alg:: Union{SciMLLinearSolveAlgorithm, Nothing} ,
186+ function SciMLBase. solve (prob:: LinearProblem , :: Nothing , args... ;
187+ assump = OperatorAssumptions (issquare (prob. A)), kwargs... )
188+ return solve (prob, defaultalg (prob. A, prob. b, assump), args... ; kwargs... )
189+ end
190+
191+ function SciMLBase. solve (prob:: LinearProblem , alg:: SciMLLinearSolveAlgorithm ,
185192 args... ; kwargs... )
186193 solve! (init (prob, alg, args... ; kwargs... ))
187194end
0 commit comments