Skip to content

Commit

Permalink
Merge pull request #475 from SciML/ChrisRackauckas-patch-1
Browse files Browse the repository at this point in the history
Try and fix ambiguity?
  • Loading branch information
ChrisRackauckas authored Feb 25, 2024
2 parents 7b090b4 + 5dfc85c commit f97cf52
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,29 @@ function SciMLBase.solve(prob::StaticLinearProblem, args...; kwargs...)
end

function SciMLBase.solve(prob::StaticLinearProblem,
alg::Union{Nothing, SciMLLinearSolveAlgorithm}, args...; kwargs...)
alg::Nothing, args...; kwargs...)
if alg === nothing || alg isa DirectLdiv!
u = prob.A \ prob.b
elseif alg isa LUFactorization
u = lu(prob.A) \ prob.b
elseif alg isa QRFactorization
u = qr(prob.A) \ prob.b
elseif alg isa CholeskyFactorization
u = cholesky(prob.A) \ prob.b
elseif alg isa NormalCholeskyFactorization
u = cholesky(Symmetric(prob.A' * prob.A)) \ (prob.A' * prob.b)
elseif alg isa SVDFactorization
u = svd(prob.A) \ prob.b
else
# Slower Path but handles all cases
cache = init(prob, alg, args...; kwargs...)
return solve!(cache)
end
return SciMLBase.build_linear_solution(alg, u, nothing, prob)
end

function SciMLBase.solve(prob::StaticLinearProblem,
alg::SciMLLinearSolveAlgorithm, args...; kwargs...)
if alg === nothing || alg isa DirectLdiv!
u = prob.A \ prob.b
elseif alg isa LUFactorization
Expand Down

0 comments on commit f97cf52

Please sign in to comment.