Skip to content

Commit

Permalink
hotfix a few more default cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Jun 5, 2023
1 parent 73a1395 commit 45118a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LinearSolve"
uuid = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
authors = ["SciML"]
version = "2.1.7"
version = "2.1.8"

[deps]
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
Expand Down
7 changes: 5 additions & 2 deletions src/factorization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,8 @@ function init_cacheval(alg::UMFPACKFactorization, A, b, u, Pl, Pr, maxiters::Int
return SuiteSparse.UMFPACK.UmfpackLU(SparseMatrixCSC(size(A)..., getcolptr(A),
rowvals(A), nonzeros(A)))
end

elseif !(eltype(A) <: Union{Float32,Float64}) || !(eltype(b) <: Union{Float32,Float64})
return nothing # Cannot use Umfpack
else
@static if VERSION < v"1.9.0-DEV.1622"
res = SuiteSparse.UMFPACK.UmfpackLU(C_NULL, C_NULL, 0, 0,
Expand Down Expand Up @@ -782,6 +783,8 @@ function init_cacheval(alg::KLUFactorization, A, b, u, Pl, Pr, maxiters::Int, ab
if typeof(A) <: SparseArrays.AbstractSparseArray
return KLU.KLUFactorization(SparseMatrixCSC(size(A)..., getcolptr(A), rowvals(A),
nonzeros(A)))
elseif !(eltype(A) <: Union{Float32,Float64}) || !(eltype(b) <: Union{Float32,Float64})
return nothing # Cannot use KLU
else
return KLU.KLUFactorization(SparseMatrixCSC(0, 0, [1], Int64[], eltype(A)[]))
end
Expand Down Expand Up @@ -1102,7 +1105,7 @@ end

function SciMLBase.solve!(cache::LinearCache, alg::DiagonalFactorization;
kwargs...)
A = cache.A
A = convert(AbstractMatrix, cache.A)
if cache.u isa Vector && cache.b isa Vector
@simd ivdep for i in eachindex(cache.u)
cache.u[i] = A.diag[i] \ cache.b[i]
Expand Down

0 comments on commit 45118a5

Please sign in to comment.