diff --git a/src/common.jl b/src/common.jl index 34160647c..cccd941f0 100644 --- a/src/common.jl +++ b/src/common.jl @@ -115,8 +115,8 @@ function SciMLBase.init(prob::LinearProblem, alg::SciMLLinearSolveAlgorithm, args...; alias_A = default_alias_A(alg, prob.A, prob.b), alias_b = default_alias_b(alg, prob.A, prob.b), - abstol = default_tol(eltype(prob.A)), - reltol = default_tol(eltype(prob.A)), + abstol = default_tol(eltype(prob.b)), + reltol = default_tol(eltype(prob.b)), maxiters::Int = length(prob.b), verbose::Bool = false, Pl = IdentityOperator(size(prob.A)[1]), @@ -150,6 +150,10 @@ function SciMLBase.init(prob::LinearProblem, alg::SciMLLinearSolveAlgorithm, fill!(u0, false) end + # Guard against type mismatch for user-specified reltol/abstol + reltol = eltype(prob.b)(reltol) + abstol = eltype(prob.b)(abstol) + cacheval = init_cacheval(alg, A, b, u0, Pl, Pr, maxiters, abstol, reltol, verbose, assumptions) isfresh = true