Skip to content

Commit

Permalink
Merge pull request #397 from ma-sadeghi/enh/promote-tol-dtype
Browse files Browse the repository at this point in the history
Promote abstol and reltol type to match eltype(A)
  • Loading branch information
ChrisRackauckas authored Oct 20, 2023
2 parents f4f6940 + 4c77e2c commit 3f879bd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3f879bd

Please sign in to comment.