Skip to content

Commit 6323432

Browse files
committed
fix default solver
1 parent 47d4d68 commit 6323432

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ext/LinearSolveForwardDiffExt.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ end
4949

5050
function linearsolve_forwarddiff_solve(cache::DualLinearCache, alg, args...; kwargs...)
5151
# Solve the primal problem
52+
@info "here"
5253
dual_u0 = copy(cache.linear_cache.u)
5354
sol = solve!(cache.linear_cache, alg, args...; kwargs...)
5455
primal_b = copy(cache.linear_cache.b)
@@ -131,7 +132,7 @@ function SciMLBase.init(
131132
verbose::Bool = false,
132133
Pl = nothing,
133134
Pr = nothing,
134-
assumptions = nothing,
135+
assumptions = OperatorAssumptions(issquare(prob.A)),
135136
sensealg = LinearSolveAdjoint(),
136137
kwargs...)
137138
(; A, b, u0, p) = prob
@@ -144,15 +145,15 @@ function SciMLBase.init(
144145

145146
primal_prob = remake(prob; A = new_A, b = new_b, u0 = new_u0)
146147

147-
assumptions = OperatorAssumptions(issquare(primal_prob.A))
148-
149148
if get_dual_type(prob.A) !== nothing
150149
dual_type = get_dual_type(prob.A)
151150
elseif get_dual_type(prob.b) !== nothing
152151
dual_type = get_dual_type(prob.b)
153152
end
153+
Main.@infiltrate
154154
non_partial_cache = init(
155-
primal_prob, alg, args...; alias = alias, abstol = abstol, reltol = reltol,
155+
primal_prob, LinearSolve.defaultalg(primal_prob.A, primal_prob.b, assumptions), args...;
156+
alias = alias, abstol = abstol, reltol = reltol,
156157
maxiters = maxiters, verbose = verbose, Pl = Pl, Pr = Pr, assumptions = assumptions,
157158
sensealg = sensealg, u0 = new_u0, kwargs...)
158159
return DualLinearCache(non_partial_cache, dual_type, ∂_A, ∂_b, !isnothing(∂_b) ? zero.(∂_b) : ∂_b, A, b, zeros(dual_type, length(b)))

0 commit comments

Comments
 (0)