Skip to content

Commit 3f879bd

Browse files
Merge pull request #397 from ma-sadeghi/enh/promote-tol-dtype
Promote abstol and reltol type to match eltype(A)
2 parents f4f6940 + 4c77e2c commit 3f879bd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/common.jl

+6-2
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ function SciMLBase.init(prob::LinearProblem, alg::SciMLLinearSolveAlgorithm,
115115
args...;
116116
alias_A = default_alias_A(alg, prob.A, prob.b),
117117
alias_b = default_alias_b(alg, prob.A, prob.b),
118-
abstol = default_tol(eltype(prob.A)),
119-
reltol = default_tol(eltype(prob.A)),
118+
abstol = default_tol(eltype(prob.b)),
119+
reltol = default_tol(eltype(prob.b)),
120120
maxiters::Int = length(prob.b),
121121
verbose::Bool = false,
122122
Pl = IdentityOperator(size(prob.A)[1]),
@@ -150,6 +150,10 @@ function SciMLBase.init(prob::LinearProblem, alg::SciMLLinearSolveAlgorithm,
150150
fill!(u0, false)
151151
end
152152

153+
# Guard against type mismatch for user-specified reltol/abstol
154+
reltol = eltype(prob.b)(reltol)
155+
abstol = eltype(prob.b)(abstol)
156+
153157
cacheval = init_cacheval(alg, A, b, u0, Pl, Pr, maxiters, abstol, reltol, verbose,
154158
assumptions)
155159
isfresh = true

0 commit comments

Comments
 (0)